인라인 SVG 요소의 HTML 태그 내에서 CSS 사용자 정의 속성을 사용할 수 있습니까?
인라인 svg 요소가 있다고 가정합니다.
<svg style="width:var(--image-width);" />
이제이 문은 유효하지 않지만 css 파일 대신 HTML 파일에서 --image-width를 사용하는 방법이 있습니까?
속성을 정의하는 css 파일을 가져 오면 작동합니다 --image-width
.
/* style.css */
:root {
--image-width: 42px;
}
<!-- Your html file -->
<link rel="stylesheet" href="style.css">
<svg style="width: var(--image-width);">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다