【发布时间】:2016-10-22 04:12:51
【问题描述】:
小提琴:https://jsfiddle.net/z1mdvkgq/
HTML:
<div class="test" style="overflow: hidden; width: 650px; height: 350px; background: #CCC; position: relative;">
<div class='control' tabindex='1'>
<div class='btn'></div>
<i class="icon-search ion-search" style="
content: url('https://cdn4.iconfinder.com/data/icons/wirecons-free-vector-icons/32/add-128.png');
width: 55px;
position: absolute;
left: 10%;
top: 8%;
outline: none;"></i>
</div>
<i class='icon-close ion-ios-close-empty'>CLOSE</i>
</div>
如何解决“+”在 Chrome 中显示但在 IE 中不显示的问题。
css url() not recognized in internet explorer 10 解释使用背景而不是 content,但这在我的情况下不起作用。
【问题讨论】:
-
Chrome 中不显示背景。我已经尝试过这种方法
-
那么也许stackoverflow.com/questions/18202306/…,如果你已经做过这项研究提及。
-
@Si8 您在常规元素上使用
content,而不是伪元素。作为潜在重复链接的答案解释了这一点。 -
@Si8 那是因为(1它没有高度(2你需要将
background-size设置为contain