IE8, XHTML, position: fixed; and z-index

删除回忆录丶 提交于 2019-12-11 23:32:04

问题


I have an XHTML 1.0 transitional Doctype.

I have a <div> that is position: fixed; bottom: 0px; left: 0px; width: 100%; z-index: 200;.

Inside that <div> I have two buttons which are position relative, aligned right, with a set z-index of 201;

In Firefox the bar at the bottom and the two buttons are correctly located at the bottom.

In IE8 however, the bar is visible and the z-index appears to be overlaying the other content, but the buttons are hidden behind the main div, despite being children and having their z-index set.

I'm using the following meta tag; <meta http-equiv="X-UA-Compatible" content="IE=edge" /> to force the document into IE8 mode.

If I emulate IE7 (put on compatability mode), the bar and buttons work just fine. I don't understand how IE7's rendering is better than IE8. I don't want to have to force compatability mode due to other things that IE7 cannot render and IE8 can. Is there another solution, or have I missed something?

Thanks.


回答1:


I have solved the issue by taking the buttons out of the container/bar, and positioning them fixed themselves. Works in IE7,IE8,Firefox - Chrome doesn't like doing 100% on the position: fixed; bar. Damnit.




回答2:


http://brenelz.com/blog/squish-the-internet-explorer-z-index-bug/

try giving the parent element a higher z-index number(it does assume that you have a separate stylesheet for ie though)

Also, try using this doctype to force the rendering to ie8 standards compliant mode as opposed to using edge(which means you get the newest version always)

more info here: http://www.alistapart.com/articles/beyonddoctype

"That’s because even Eric Meyer can’t predict layout or scripting bugs that may be accidentally introduced by a new browser version."



来源:https://stackoverflow.com/questions/2957084/ie8-xhtml-position-fixed-and-z-index

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!