I’m having trouble trying to figure out why chrome (which makes the fixed header completely disappear, Firefox keeps it there but lets absolutely positioned elements flow over the fixed element, I’ve averted the problem using opacity:.99, but I still wracks my mind how that does anything to fix it.
http://www.rickpascua.cu.cc/newsite-snazzy/index.html <— problem page.
I still don’t actually know why the CSS animation is breaking the layout. In my testing, with the animations running, having
overflow:hidden;z-indexon the header was causing it to lose fixed positioning! However, I do have an answer.To begin with, remove
from the fixed position header element
<div id="header">.However with those 3 properties removed, the
<div id="slide-contain"/>will still overlap! This is because of the implicit stacking context layering, see the 7 layers in the CSS_absolute_and_fixed_positioning#The_third_dimension article.The unwanted overlap occurs because
position:relativehas been set on the<div id="slide-contain"/>(which is a descendent of the<div id="wrapper"/>) but there is noz-indexon that element. I realise that the relative positioning was added because you want to absolutely position some child elements inside.Therefore the
<div id="slide-contain"/>element is on the same Z-plane as every other element without a z-index on the page, which includes the fixed header. Both elements are at Level 6 – Positioned descendants with the stack level set as auto or (zero), according to the linked article and stacking defaults to the order in which the elements appear on the DOM, so the<div id="slide-contain"/>is rendered over `.So a
z-index:1is required on the header to always render the header on top. It just needs to be greater than 0, so changez-index:99toz-index:1An alternate solution would be to supply a negative
z-index(andposition:relative) on the following sibling<div id="wrapper"/>.You might think that adding a negative
z-indexon the<div id="slide-contain"/>would be enough but it would need duplicating to the element ancestors, otherwise the<div id="slide-contain"/>would be pushed behind its parent.