示例工程 25-responsive-images
25-responsive-images/app/assets/product-400.svg
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="300" viewBox="0 0 400 300" role="img" aria-label="占位产品图 400 × 300">
<defs>
<linearGradient id="g" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#2563eb"/>
<stop offset="1" stop-color="#7c3aed"/>
</linearGradient>
</defs>
<rect width="400" height="300" fill="url(#g)"/>
<circle cx="288" cy="90" r="54" fill="rgb(255 255 255 / 22%)"/>
<rect x="40" y="174" width="176" height="48" rx="9" fill="rgb(255 255 255 / 85%)"/>
<text x="40" y="210" font-family="ui-monospace, Menlo, monospace" font-size="14" fill="#1e3a8a">400 × 300</text>
<text x="40" y="120" font-family="ui-monospace, Menlo, monospace" font-size="10" fill="rgb(255 255 255 / 90%)">responsive image</text>
</svg>