示例工程 25-responsive-images

25-responsive-images/demo-01-srcset/assets/product-1200.svg

xml · 0.8 KB

运行:srcset 与 sizes

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

<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="900" viewBox="0 0 1200 900" role="img" aria-label="占位产品图 1200 × 900">
  <defs>
    <linearGradient id="g" x1="0" y1="0" x2="1" y2="1">
      <stop offset="0" stop-color="#7c3aed"/>
      <stop offset="1" stop-color="#db2777"/>
    </linearGradient>
  </defs>
  <rect width="1200" height="900" fill="url(#g)"/>
  <circle cx="864" cy="270" r="162" fill="rgb(255 255 255 / 22%)"/>
  <rect x="120" y="522" width="528" height="144" rx="27" fill="rgb(255 255 255 / 85%)"/>
  <text x="120" y="630" font-family="ui-monospace, Menlo, monospace" font-size="42" fill="#1e3a8a">1200 × 900</text>
  <text x="120" y="360" font-family="ui-monospace, Menlo, monospace" font-size="30" fill="rgb(255 255 255 / 90%)">responsive image</text>
</svg>