SVG 스타일 속성
SVG 스타일 속성
SVG는 넓은 펜 속성을 제공합니다. 이 장에서는 다음 내용을 논의할 것입니다:
stroke
stroke-width
stroke-linecap
stroke-dasharray
모든 터치 속성은 어떤 유형의 선, 텍스트 및 요소의轮廓(예: 원)에 사용할 수 있습니다.
SVG stroke 속성
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>
SVG stroke-width 속성
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>
SVG stroke-linecap 속성
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>
SVG stroke-dasharray 속성
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>