我想使用SVG在整个页面上制作波浪线,并且它应该是响应式的,无论屏幕宽度如何,都可以跨页面伸展。如何创建响应SVG图像
我在这个StackOverflow文章中看到了我想要的那种东西,但是SVG只产生一个固定宽度的图像。
<svg height="125" width="1349">
<path d="M -35 100 s 35 50 75 0" stroke="rgb(255, 195, 56)" stroke- width="5" fill="none" />
<path d="M 40 100 s 75 -125 150 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="rgb(255, 195, 56)" />
<path d="M 190 100 s 35 50 75 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="none" />
<path d="M 265 100 s 75 -125 150 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="rgb(255, 195, 56)" />
<path d="M 415 100 s 35 50 75 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="none" />
<path d="M 490 100 s 75 -125 150 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="rgb(255, 195, 56)" />
<path d="M 640 100 s 35 50 75 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="none" />
<path d="M 715 100 s 75 -125 150 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="rgb(255, 195, 56)" />
<path d="M 865 100 s 35 50 75 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="none" />
<path d="M 940 100 s 75 -125 150 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="rgb(255, 195, 56)" />
<path d="M 1090 100 s 35 50 75 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="none" />
<path d="M 1165 100 s 75 -125 150 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="rgb(255, 195, 56)" />
<path d="M 1315 100 s 35 50 75 0" stroke="rgb(255, 195, 56)" stroke-width="5" fill="none" />
Sorry, your browser does not support inline SVG.
</svg>
一个可能的解决方案是使用javascript在整个页面宽度上重复使用SVG。或者我想我可以将许多图像链接在一起,并使用媒体查询隐藏/显示足以填充页面宽度,但这似乎是一个笨拙的解决方案。
有谁知道纯SVG/HTML5解决方案?
删除'height =“125”width =“1349”' –
https://tympanus.net/codrops/2014/08/19/making-svgs-responsive-with-css/ –