Relative question: 'transform3d' not working with position: fixed children
TL;DR: Here is a jsfiddle. Basically the purple element should be on top of the two orange bars, it should be the whole view screen.
The whole story (before knowing what the problem was):
I have the following situation, one toolbar on top of my page and one on bottom and some contents between. In that contents between I would like to have an element that could be full screen if I want, overlapping everything on the view screen (lets say make the whole screen black).
<div id="top-toolbar" style="position: absolute; z-index: 1"></div>
<div id="contents" style="position: absolute; z-index: 1">
<div id="fullscreen" style="position:fixed; z-index: 999"></div>
</div>
<div id="bottom-toolbar" style="position: absolute; z-index: 1"></div>
What I know is that this seems impossible due to how stack order works.The #fullscreen
element can only be as big as the #contents
element is. Am I correct on this?
Bare in mind that the toolbar elements can not be manipulated.
Is the solution to just move the #fullscreen element outside of the #contents div when I need it to overlap everything and move it back inside when I don't?
All this is in order to hack together a video "fullscreen".
EDIT: It seems that what you all have suggested and what I did try before asking, that is to make the element fixed and stretch it, should work. However in my case for some reason it doesn't. The #contents
element has some css property that prevents the fixed element to stretch further than the #contents
size. If I put top:0 on the #fullscreen
it will got to the top of the #contents
and not the document
/body
. It seems to act as if it is not fixed but absolute.
EDIT2: Found the culprit. The #contests
has transform: translate3d(0%,0,0px)
. Need a way to circumvent this now without touching the #contents
css properties.