I've been trying for the last few hours to figure out how come a child element was positioning against its parent and not the screenport even though it's positioned as 'fixed'. Very luckily, I stumbled across the mentioning that -webkit-transform: translate3d(0, 0, 0)
on the parent can make things go awry. I'm using bootstrap
framework and so they indeed put this property on the .navbar-fixed-top
class which one of parent elements had. Once I removed it the child started to position agains viewport. So I have two questions:
- Why does
-webkit-transform: translate3d(0, 0, 0)
do these nasty things? - Why do bootstrap guys put this property for the
.navbar-fixed-top
class?
UPDATE
Well, it seems that I've found the answer to the second question. Here is the commit message:
Applied translate3d to modal, navbar-fixed and affix to combat browser repaint
Here is the answer to the second question:
Any computed value other than none for the transform results in the creation of both a stacking context and a containing block. The object acts as a containing block for fixed positioned descendants.