我正在从Illustrator中将向量(徽标)导出为SVG(1.1)。该向量没有渐变或透明性。
当我在CSS中使用SVG作为背景图像时,没有显示任何内容,但是当我访问图像链接(http://www.something.com/logo.svg)时,它完美地显示了该图像。
CSS
#site-header {
margin: 0;
padding: 0;
display: block;
width: 100%;
height: 62px;
top: 0;
left: 0;
position: fixed;
z-index: 2000;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
overflow: hidden;
background-color: #758391;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-perspective: 1000;
perspective: 1000;
-webkit-box-shadow: 0 0 2px rgba(6, 8, 8, 0.15);
box-shadow: 0 0 2px rgba(6, 8, 8, 0.15);
}
#site-header #logo {
display: inline-block;
float: none;
width: 10%;
min-width: 48px;
height: 100%;
max-height: 40px;
margin: 12px 0;
vertical-align: middle;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#site-header #logo a {
width: 100%;
height: 100%;
display: block;
background: rgba(0, 0, 0, 0) url("img/logo.svg") no-repeat center center;
}
的HTML
<header id="site-header">
<hgroup id="logo">
<a href="#">
<h1>
<span class="hide">some hidden content</span>
</h1>
</a>
</hgroup>
</header>
顺便说一句,当我尝试在img元素中使用svg时,它不起作用。
知道为什么在用作CSS背景时为什么不显示我的SVG吗?
谢谢
好的,我发现了问题。这与服务器有关,我只是在.htaccess中添加了SVG支持
AddType image/svg+xml svg
AddType image/svg+xml svgz
谢谢
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句