Issues with negative z-index in IE8

假装没事ソ 提交于 2019-12-24 11:19:03

问题


I am using two pseudo elements to create a banner effect on a div, like so:

div { position: relative; width: 200px; background-color: #999; }
div:before, div:after { content: ""; width: 10px; height: 0; display: block; position: absolute; z-index: -1; top: 10px; border-top: 10px solid #666; border-bottom: 10px solid #666; }
div:before { right: -20px; border-right: 10px solid transparent; border-left: 10px solid #333; }
div:after { left: -20px; border-left: 10px solid transparent; border-right: 10px solid #333; }

It works fine in FF, Chrome, Safari & IE9, but no luck with IE8. The two elements with z-index of -1 show above parent. Is there any way to get this to work?


回答1:


You should try setting a z-index of 1 to div.



来源:https://stackoverflow.com/questions/5038676/issues-with-negative-z-index-in-ie8

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