は、広範囲な stroke プロパティを提供しています。この章では、次のプロパティを見て行きます:
すべての stroke プロパティは、あらゆる種類の線、テキストや circle 要素などのアウトラインに適用することができます。
stroke プロパティは、線、テキストまたは要素のアウトラインの色を定義します:
SVG コードは次の通りです:
<svg height="80" width="300">
<g fill="none">
<path stroke="red" d="M5 20 l215 0" />
<path stroke="black" d="M5 40 l215 0" />
<path stroke="blue" d="M5 60 l215 0" />
</g>
</svg>
Try it Yourself »
stroke-width プロパティは、行、テキストまたは要素のアウトラインの太さを定義します:
SVG コードは次の通りです:
<svg height="80" width="300">
<g fill="none" stroke="black">
<path stroke-width="2" d="M5 20 l215 0" />
<path stroke-width="4" d="M5 40 l215 0" />
<path stroke-width="6" d="M5 60 l215 0" />
</g>
</svg>
Try it Yourself »
stroke-linecap プロパティは、開いたパスにいろいろな種類の線端を定義します:
SVG コードは次の通りです:
<svg height="80" width="300">
<g fill="none" stroke="black" stroke-width="6">
<path stroke-linecap="butt" d="M5 20 l215 0" />
<path stroke-linecap="round" d="M5 40 l215 0" />
<path stroke-linecap="square" d="M5 60 l215 0" />
</g>
</svg>
Try it Yourself »
stroke-dasharray プロパティは、破線を作成するために使用します:
SVG コードは次の通りです:
<svg height="80" width="300">
<g fill="none" stroke="black" stroke-width="4">
<path stroke-dasharray="5,5" d="M5 20 l215 0" />
<path stroke-dasharray="10,10" d="M5 40 l215 0" />
<path stroke-dasharray="20,10,5,5,5,10" d="M5 60 l215 0" />
</g>
</svg>
Try it Yourself »