gpt4 book ai didi

css - SVG 背景图像在::在 IE 中不显示之后

转载 作者:太空宇宙 更新时间:2023-11-04 08:05:29 32 4
gpt4 key购买 nike

我有这个 SCSS 代码:

.page-collapse {

// ...

&__title {
// ...
position: relative;

&::after {
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg width="16" height="16" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg"%3E%3Ctitle%3Eicon-plus%3C/title%3E%3Cg id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="square"%3E%3Cg id="modules/cards/events-ext" transform="translate(-183 -1212)" stroke="%232F2F2F" stroke-width="1.5"%3E%3Cg id="ui/plus-black2" transform="translate(184 1213)"%3E%3Cpath d="M7 .5v13m6.5-6.499H.5" id="Line"/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
background-position: 50%;
background-size: 100% 100%;
content: '';
height: 1rem;
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: 1rem;
}
}
}

这在 Chrome 和 FF 中运行良好,如下所示:

enter image description here

但在 IE 中不是:

enter image description here

难道 IE 不喜欢::after-Elements 中的背景图像?因为还有另一种情况,使用此代码(覆盖 Bootstraps (4 alpha.6) 自定义复选框类:

.custom-control-input {

&:checked {
~.custom-control-indicator {
background-color: $white;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='12' height='11' viewBox='0 0 12 11' version='1.1' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='Styleguide' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' stroke-linecap='square'%3E%3Cg id='styles-forms' transform='translate(-333 -2181)' stroke-width='1.5' stroke='%232F2F2F'%3E%3Cg id='Group-2' transform='translate(329 2141)'%3E%3Cg id='Group'%3E%3Cpath id='icon-checkmark' d='M5 46.744L7.2 49l7.8-8'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
}
}

这在所有浏览器中都有效。我看到的唯一区别是第一种情况是在::after 伪元素中。此外,在 IE 开发工具中,相应的 CSS 部分被划掉了:

enter image description here

有什么想法吗?

编辑:我只需要支持低至 IE10

最佳答案

我发现了问题...出于某种原因,IE 中似乎存在某种解析问题,将 ' 与 "互换解决了问题,因此更改此设置:

background-image: url('data:image/svg+xml;charset=utf8,%3Csvg width="16" height="16" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg"%3E%3Ctitle%3Eicon-plus%3C/title%3E%3Cg id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="square"%3E%3Cg id="modules/cards/events-ext" transform="translate(-183 -1212)" stroke="%232F2F2F" stroke-width="1.5"%3E%3Cg id="ui/plus-black2" transform="translate(184 1213)"%3E%3Cpath d="M7 .5v13m6.5-6.499H.5" id="Line"/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E');

background-image: url("data:image/svg+xml;charset=utf8,%3Csvg width='16' height='16' viewBox='0 0 16 16' version='1.1' xmlns='http://www.w3.org/2000/svg'%3E%3Ctitle%3Eicon-plus%3C/title%3E%3Cg id='Symbols' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' stroke-linecap='square'%3E%3Cg id='modules/cards/events-ext' transform='translate(-183 -1212)' stroke='%232F2F2F' stroke-width='1.5'%3E%3Cg id='ui/plus-black2' transform='translate(184 1213)'%3E%3Cpath d='M7 .5v13m6.5-6.499H.5' id='Line'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E");

做的工作...你知道的越多。

关于css - SVG 背景图像在::在 IE 中不显示之后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46667122/

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