gpt4 book ai didi

css - IE中伪元素之前列表中绝对定位的图像内容(11)

转载 作者:太空宇宙 更新时间:2023-11-04 01:42:35 33 4
gpt4 key购买 nike

我正在尝试在 :before 伪元素上设置图像。当然,它适用于除 IE11 之外的所有浏览器。这里的定位没有按预期工作。

<ol>
<li>
:before

li {
position: relative;
}

li:before {
content: url('image.svg');
position: absolute;
width: 2.3em
top: 2.5em;
left: 1.2em;
}

问题是IE11好像对图片内容有问题。它适用于文本,但不适用于 content: url()

这是带有 top: 0; 的文本的样子左:0;: enter image description here

这就是图像在 top: 0 时的样子;左:0;: enter image description here

IE11 是否需要一些特殊的东西来完成这项工作。或者只是不可能以这种方式做到这一点?您将如何定位这些元素,以便它们在大多数浏览器和 IE11 中工作?

最佳答案

不要使用content,尝试使用background-image 属性并根据需要调整位置...

li:before {
content: '';
background-image: url('image.svg');
position: absolute;
display: block;
width: 2.3em;
height: //
background-size: //
top: 2.5em;
left: 1.2em;
}

关于css - IE中伪元素之前列表中绝对定位的图像内容(11),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45145812/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com