IE8中负z-index的问题 [英] Issues with negative z-index in IE8

查看:147
本文介绍了IE8中负z-index的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用两个伪元素在div上创建横幅效果,如下所示:

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; }

在FF,Chrome,Safari和&# IE9,但IE8没有运气。 z-index为-1的两个元素显示在父元素上方。有没有办法让这个工作?

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?

推荐答案

你应该尝试设置 z-index 1到 div

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

这篇关于IE8中负z-index的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆