This question already has answers here:
CSS :after not adding content to certain elements
                                
                                    (3个答案)
                                
                        
                                5年前关闭。
            
                    
我正在用伪元素设置<hr>元素的样式,但是Internet Explorer 11不支持它。

它应该是这样的:
http://oi57.tinypic.com/23rsio2.jpg

hr {
    height:1px;
    background-color:#D1D1D1;
    border:0; margin:30px 90px;
}

hr:after {
    background:url('../images/hr.png') no-repeat top center;
    content:"";
    display:block;
    height:30px;
    position:relative;
    top:-15px;
}


我希望有一个人可以帮助我。
提前致谢!

最佳答案

伪元素的处理方式与附加元素的子代相同。

<hr>
    <psuedo-element-after> image here </psuedo-element-after>
</hr>


这是无效的,因为<hr />不允许子级。因此,它将无法正常工作。

考虑将背景图像应用于<hr />本身,或使用类似类的方法来实现,例如:<div class="divider"></div>

10-05 20:39
查看更多