SVG 스트로크 속성


SVG 스트로크 속성

SVG는 광범위한 획 속성을 제공합니다. 이 장에서는 다음을 살펴볼 것입니다.

  • 뇌졸중
  • 획 너비
  • 스트로크 라인 캡
  • 스트로크-다샤레이

모든 획 속성은 원과 같은 요소의 모든 종류의 선, 텍스트 및 윤곽선에 적용할 수 있습니다.


SVG 스트로크 속성

stroke 속성은 요소의 선, 텍스트 또는 윤곽선의 색상을 정의합니다.

Sorry, your browser does not support inline SVG.

다음은 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>

SVG 획 너비 속성

stroke-width 속성은 요소의 선, 텍스트 또는 윤곽선의 두께를 정의합니다.

Sorry, your browser does not support inline SVG.

다음은 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>


SVG stroke-linecap 속성

stroke-linecap 속성은 열린 경로에 대한 다양한 유형의 끝을 정의합니다.

Sorry, your browser does not support inline SVG.

다음은 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>

SVG 스트로크-dasharray 속성

stroke-dasharray 속성은 점선을 만드는 데 사용됩니다.

Sorry, your browser does not support inline SVG.

다음은 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>