<defs> : 그래픽, 마스크 , 그래디언트 등의 요소들을 담아두는 태그
참조할 <path>태그를 <defs>태그로 감싸준 후 id값 설정
> 하단에 참조할 <text> 태그의 위치를 잡아주고 path를 연결해줄 <textpath> 태그를 내부에 위치시킴
><textpath>에 앞서 설정한 <path> 태그의 id 값 설정
<svg class="svg" xmls = "http://www.w3org/2000/svg">
<!--defs 참조할 그래픽,마스크,그래디언트 등을 담아두는 공간-->
<defs>
<path id="text-curve"d="M 50 400 C 50 400, 300 500, 400 400 C 400 400,600 170,700 300"></path>
</defs>
<text x = "20" y = "50">
<textPath href="#text-curve">
Lorem <tspan class="blue">ipsum</tspan> dolor sit, amet consectetur adipisicing elit. Quaerat, natus obcaecati maxime volt numquam! Reprehenderit suscipit quam aliquam harum!
</textPath>
</text>
</svg>
body{
margin:0;
padding:0;
box-sizing:border-box;
}
.svg{
position:absolute;
width:100%;
height:100%;
background:#ccc;
}
text{
font-size:1.5rem;
font-weight:800;
fill:red;
}
path{
stroke:red;
fill:transparent;
}
.blue{
fill:green;
}
'프론트엔드 공부 > html css' 카테고리의 다른 글
css animation fill-mode(애니메이션상태조정) (0) | 2021.05.07 |
---|---|
svg dash-array와 stroke 활용하여 움직이는 글자 만들기 (0) | 2021.05.05 |
overflow:hidden 이외에 iframe scroll 없애는 방법 ! (0) | 2021.05.04 |
css rotate , transform-origin으로 중심축 잡기 (0) | 2021.05.01 |
css grid 반응형 예제 (0) | 2021.04.29 |