开发者

Does css position property affect priority of z-index?

开发者 https://www.devze.com 2023-03-06 00:35 出处:网络
I have read severals questions/articles about z-index on stackoverflow, but I am still unable to solve last problem with z-index property on my webpage.

I have read severals questions/articles about z-index on stackoverflow, but I am still unable to solve last problem with z-index property on my webpage.

The simple question: Doe开发者_运维问答s element with position:absolute always overlap the element with postion:relative, no matter of value of their z-index?

I need to force element with position:relative;z-index:50 to overlap the element with postion:aboslute;z-index:5;. I would even use script if necessary.

There is webpage with that issue: sample page

Note: That webpage is highly based on z-index, and there is a lot of not elegant css solutions (sticky footer, background repeat). I it's almost working but as you can see, the <div id="mainContent"> some text </div> have position relative and have negative bottom margin to overlap the footer. But the footer (<div id="footerFixWrapper"></div>) have absolute postion, and its overlaps mainConetnet no matter it have lower z-index.


It looks as if the divs exist in different stacking contexts. In this situation, z-index will not affect either in relation to each other.

CSS-Discuss Wiki has the details: http://css-discuss.incutio.com/wiki/Overlapping_And_ZIndex

0

精彩评论

暂无评论...
验证码 换一张
取 消