I am using -webkit-transform (and -moz-transform / -o-transform) to rotate a div. Also have position fixed added so the div scrols down with the user.
In Firefox it works fine, but in webkit based browsers it's broken. After using the -webkit-transform, the position fixed doesn't work anymore! How is that possible?
Something (a bit hacky) that worked for me is to
position:sticky
instead:I had this issue whilst trying to implement react-color with react-swipeable-views (rsw). The problem for me was that rsw applies
translate(-100%, 0)
to a tab panel which breaks the default fixed position div added over the full screen which when clicked closes the color picker model.For me the solution was to apply the opposite transform to the fixed element (in this case
translate(100%, 0)
which fixed my issue. I'm not sure if this is useful in other cases but thought I would share anyway.Here is an example showing what I've described above:
https://codepen.io/relativemc/pen/VwweEez
For anyone who finds their background images are disappearing in Chrome because of the same issue with background-attachment: fixed; - this was my solution:
If you can use javascript as an option this can be a workaround for positioning a position fixed element relavtive to the window when it's inside a transformed element:
Granted you will also have to adjust your heights and width because
fixedEl
will be calculating it's with based on it's container. That depends on your use case but this will allow you to predictably set the something position fixed, regardless of it's container.Probably due to a bug in Chrome as I can't replicate in Safari nor Firefox, but this works in Chrome 40.0.2214.111 http://jsbin.com/hacame/1/edit?html,css,output
It's a very particular structure so it's by no means a universally applicable one-lined css fix, but perhaps someone can tinker with it to get it working in Safari and Firefox.