IE11上的图标消失了

时间:2021-06-17 11:08:54

标签: html css icons internet-explorer-11

我在使用 IE11 的 html 上看不到某些图标。 这是图标的css代码

.icon_sms:before {
    display: block;
    content: '';
    height: 8em;
    width: 8em;
    vertical-align: middle;
    background-repeat: no-repeat;
    background-image:
        url([...]);
}

我也尝试过使用 display: inline-block,但它也不起作用。

在 html head 上也有 no-cache 属性

还有 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 在头上的第一个属性

有什么建议吗?

非常感谢

最好的问候

2 个答案:

答案 0 :(得分:0)

我认为您不能在 IE11 中使用伪元素。要了解您可以在每个浏览器中使用哪些技术,我推荐网络 caniuse。很多技术都很清楚。

您可以在此 link 中看到接受 before 伪元素的浏览器。希望对你有用。

答案 1 :(得分:0)

根据你的描述和你提供的代码,我做了一个简单的测试,发现在IE11下运行正常。

一个简单的测试:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <style>
        .icon_sms:before {
            display: block;
            clear: both;
            content: '';
            height: 40em;
            width: 40em;
            vertical-align: middle;
            background-repeat: no-repeat;
            background-image: url(https://i.stack.imgur.com/UzYKM.gif);
        }
    </style>
</head>
<body>
    <div class="icon_sms" style="border:1px solid red">some text</div>
</body>
</html>

因为您还没有发布图片网址和任何 html 代码。我猜可能是因为之前样式中的尺寸不够大,无法显示图像。 尝试修改例子中的高度和宽度为8em,不会显示。

如果能贴出相关完整的例子,有助于解决问题,谢谢理解。