我一直在努力寻找一个好的解决方案,使得SVG图形能够响应屏幕宽度并且高度可调。我尝试将width设置为100%,height设置为200px
,但没有成功。
header.svg {
width: 100%;
max-height: 200px;
height: 200px;
}
<header>
<svg width="321px" height="141px" viewBox="0 0 321 141" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs></defs>
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="header-copy-" fill="#262626">
<g id="header-copy-2">
<path d="M0,0.31823636 L321,0.31823636 L321,132.556396 C267.894961,138.185465 214.394961,141 160.5,141 C106.605039,141 53.1050387,138.185465 0,132.556396 L0,0.31823636 Z" id="Rectangle-Copy-12"></path>
</g>
</g>
</g>
</svg>
</header>
100%
。
preserveaspectratio:none
...这很重要。 - Paulie_Dmax-height
。它就在CSS中。 - Paulie_D