【发布时间】:2017-09-05 05:28:59
【问题描述】:
在 div 中使用了一个 svg 图像,宽度为 50px,但在 IE11 中,SVG 高度为 150px。它应该是 50px X 50px 。宽度 50px 正确应用而不是高度。任何建议,
.svg-cont{
width:50px
}
img{
max-width:100%;
height:auto;
}
<div class="svg-cont">
<img src="http://imgh.us/google-plus-hvr.svg" alt="" />
</div>
提前感谢您的帮助。代码笔:http://codepen.io/shmdhussain/pen/YZmrOq
【问题讨论】:
-
SVG 文件中的
preserveAspectRatio属性怎么样? -
@dejauneetdebleu:我在阅读了一些关于 SVG 的文章后解决了这个问题,这篇来自 Sara tympanus.net/codrops/2014/08/19/making-svgs-responsive-with-css 的文章有所帮助。将宽度设置为 100% 以解决 IE9-11 中的问题