【问题标题】:SVG Height not adjusting with aspect ratio [duplicate]SVG高度不随纵横比调整[重复]
【发布时间】: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

【问题讨论】:

标签: html css svg


【解决方案1】:

感谢 将 width:100% 设置为图像标签后问题已解决。问题已解决 pen codepen:http://codepen.io/shmdhussain/pen/XMvzWv

.svg-cont{
  width:50px
}
img{
  max-width:100%;
  width:100%;
  height:auto;
}
<div class="svg-cont">
  <img src="http://imgh.us/google-plus-hvr.svg" alt="" />
</div>

参考:https://tympanus.net/codrops/2014/08/19/making-svgs-responsive-with-css/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-21
    • 1970-01-01
    • 2014-07-10
    • 2014-04-17
    • 2017-11-16
    • 2022-01-23
    • 2013-04-05
    • 2017-03-28
    相关资源
    最近更新 更多