リスト4. 線の幅を指定
<!-- 線幅=1(デフォルト) -->
<line x1="50" y1="20" x2="450" y2="20"/>
<!-- 線幅=3px -->
<line x1="50" y1="50" x2="450" y2="50" stroke-width="3px"/>
<!-- 線幅=3mm -->
<line x1="50" y1="80" x2="450" y2="80" stroke-width="3mm"/>
<!-- 線幅=0.3em -->
<line x1="50" y1="110" x2="450" y2="110" stroke-width="0.3em"/>
<!-- 線幅=3% -->
<line x1="50" y1="140" x2="450" y2="140" stroke-width="3%"/>
コーディング例
リスト5. 端部を指定
<!-- フラットな端部(デフォルト) -->
<line x1="50" y1="20" x2="450" y2="20" />
<!-- 丸めた端部 -->
<line x1="50" y1="100" x2="450" y2="100" stroke-linecap="round" />
<!-- 囲まれた端部 -->
<line x1="50" y1="180" x2="450" y2="180" stroke-linecap="square" />
コーディング例
リスト6. 接合部を指定
<!-- 面取りのない接合部(デフォルト) -->
<polyline points="50,150 100,50 150,150" />
<!-- 面取りした接合部 -->
<polyline points="200,150 250,50 300,150" stroke-linejoin="bevel" />
<!-- 丸めた接合部 -->
<polyline points="350,150 400,50 450,150" stroke-linejoin="round" />
コーディング例
リスト7. ダッシュパターンを指定
<!-- 直線(デフォルト) -->
<line x1="50" y1="20" x2="450" y2="20" />
<!-- 点線 -->
<line x1="50" y1="50" x2="450" y2="50" stroke-dasharray="2 4" />
<!-- 点線 -->
<line x1="50" y1="80" x2="450" y2="80" stroke-dasharray="10 4" />
<!-- 一点鎖線 -->
<line x1="50" y1="110" x2="450" y2="110" stroke-dasharray="10 6 2 6" />
<!-- 二点鎖線 -->
<line x1="50" y1="140" x2="450" y2="140" stroke-dasharray="10 6 2 4 2 6" />
コーディング例
リスト8. ダッシュのオフセット距離を指定
<!-- オフセット無し -->
<line x1="50" y1="20" x2="450" y2="20" />
<!-- オフセット 3px -->
<line x1="50" y1="50" x2="450" y2="50" stroke-dashoffset="3px" />
<!-- オフセット -5px -->
<line x1="50" y1="80" x2="450" y2="80" stroke-dashoffset="-5px" />
<!-- オフセット 10px -->
<line x1="50" y1="110" x2="450" y2="110" stroke-dashoffset="10px" />
コーディング例
リスト9. マーカーの適用
<defs>
<!-- マーカーを定義 -->
<marker id="Triangle"
viewBox="0 0 10 10" refX="0" refY="5"
markerUnits="strokeWidth"
markerWidth="4" markerHeight="3"
orient="auto">
<path d="M 0 0 L 10 5 L 0 10 z" stroke-width="1" fill="black" />
</marker>
</defs>
<!-- マーカーを適用 -->
<polyline points="50,80 250,80 300,150" marker-end="url(#Triangle)" />
コーディング例