示例工程 25-responsive-images

25-responsive-images/app/assets/square.svg

xml · 0.8 KB

运行:响应式图片与媒体

点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。

<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600" viewBox="0 0 600 600" role="img" aria-label="占位产品图 600 × 600 方形">
  <defs>
    <linearGradient id="g" x1="0" y1="0" x2="1" y2="1">
      <stop offset="0" stop-color="#0f172a"/>
      <stop offset="1" stop-color="#2563eb"/>
    </linearGradient>
  </defs>
  <rect width="600" height="600" fill="url(#g)"/>
  <circle cx="432" cy="180" r="108" fill="rgb(255 255 255 / 22%)"/>
  <rect x="60" y="348" width="264" height="96" rx="18" fill="rgb(255 255 255 / 85%)"/>
  <text x="60" y="420" font-family="ui-monospace, Menlo, monospace" font-size="21" fill="#1e3a8a">600 × 600 方形</text>
  <text x="60" y="240" font-family="ui-monospace, Menlo, monospace" font-size="15" fill="rgb(255 255 255 / 90%)">responsive image</text>
</svg>