stroke-width

stroke-width 属性は、図形に適用するストロークの幅を定義するプレゼンテーション属性です。

この属性は以下の SVG 要素で使用することができます。

html
<svg viewBox="0 0 30 10" xmlns="http://www.w3.org/2000/svg">
  <!-- Default stroke width: 1 -->
  <circle cx="5" cy="5" r="3" stroke="green" />

  <!-- Stroke width as a number -->
  <circle cx="15" cy="5" r="3" stroke="green" stroke-width="3" />

  <!-- Stroke width as a percentage -->
  <circle cx="25" cy="5" r="3" stroke="green" stroke-width="2%" />
</svg>

使用上のメモ

<length> | <percentage>
既定値 1px
アニメーション

メモ: パーセント値は常に、正規化された viewBox の対角線の長さに対するパーセント値として計算されます。

仕様書

Specification
Scalable Vector Graphics (SVG) 2
# StrokeWidth

ブラウザーの互換性

BCD tables only load in the browser