Kev*_*ass 6 css firefox svg pseudo-element microsoft-edge
在我朋友的网站上工作,我无法弄清楚如何在Firefox中显示SVG.在Edge中,当我调整浏览器大小时,它也会消失.
http://lene.isreborn.com/
Run Code Online (Sandbox Code Playgroud)
CSS - (我必须使用重要因为它是Wordpress):
header::after {
content:"";
display: block;
background: url(/svg-filer/header-background.svg);
background-size: contain;
background-repeat: no-repeat;
top: 0;
left:-1%;
width: 102% !important;
height: 90px !important;
position: absolute;
z-index: -1;
-ms-transition: top ease .5s;
-moz-transition: top ease .5s;
-webkit-transition: top ease .5s;
transition: top ease .5s;
}
header.sticky-active::after {
top: -20px;
}
Run Code Online (Sandbox Code Playgroud)
SVG文件:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="100%" height="90px" viewBox="0 0 1920 90" preserveAspectRatio="none">
<polygon id="XMLID_3_" fill="#FFFF00" points="1,99.7 1399.2,130 1921,99.7 1921,0 1,0 "/>
</svg>
Run Code Online (Sandbox Code Playgroud)
我现在已经明白了:背景大小不适用于“包含”,但适用于 100% 100%,请参阅
Mozilla 背景规则
链接到开发人员网站:请参阅此处
header::after {
content:"";
display: block;
background: url(/svg-filer/header-background.svg);
background-size: 100% 100% !important;
background-repeat: no-repeat;
top: 0;
left:-1%;
width: 102% !important;
height: 90px !important;
position: absolute;
z-index: -1;
-ms-transition: top ease .5s;
-moz-transition: top ease .5s;
-webkit-transition: top ease .5s;
transition: top ease .5s;
}
header.sticky-active::after {
top: -20px;
}
Run Code Online (Sandbox Code Playgroud)
图像实际上是白色的,对吗?如果将填充颜色更改为#000,您将看到一个图像:
<polygon id="XMLID_3_" fill="#000" points="1,99.7 1399.2,130 1921,99.7 1921,0 1,0 "/>
Run Code Online (Sandbox Code Playgroud)
https://jsfiddle.net/fbwsh1pf/
| 归档时间: |
|
| 查看次数: |
2664 次 |
| 最近记录: |