๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
์• ๋‹ˆ๋ฉ”์ด์…˜

SVG ์• ๋‹ˆ๋ฉ”์ด์…˜ ์˜ˆ์‹œ

by Youcodein 2022. 9. 8.
728x90
๋ฐ˜์‘ํ˜•

์˜ˆ์‹œ

HTML

HTML ์†Œ์Šค์ž…๋‹ˆ๋‹ค.


<svg viewBox="0 0 1320 300">
	<text x="50%" y="50%" dy="40px" text-anchor="middle">
		Hello smile
	</text>
</svg>

CSS

CSS ์†Œ์Šค์ž…๋‹ˆ๋‹ค.

@font-face {
    font-family: 'Tmon';
    font-weight: normal;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/tmon/Tmon.eot');
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/tmon/Tmon.eot?#iefix') format('embedded-opentype'),
         url('https://cdn.jsdelivr.net/gh/webfontworld/tmon/Tmon.woff2') format('woff2'),
         url('https://cdn.jsdelivr.net/gh/webfontworld/tmon/Tmon.woff') format('woff'),
         url('https://cdn.jsdelivr.net/gh/webfontworld/tmon/Tmon.ttf') format("truetype");
    font-display: swap;
} 
body {
	background-color: #e3f2fd;
}
svg {
	font-family: 'Tmon';
	font-size: 140px;
	position: absolute;
	width: 100%;
	height: 100%;
	text-transform: uppercase;
	animation: stroke 5s 1 alternate;
	fill: rgba(72,138,204,1);
}
@keyframes stroke {
	0%   {
		stroke-dashoffset: 25%;
		stroke-dasharray: 0 50%;
		fill: rgba(72,138,204,0);
		stroke: rgba(54,95,160,1);
		stroke-width: 2;
	}
	70%  {
		fill: rgba(72,138,204,0);
		stroke: rgba(54,95,160,1);
	}
	80%  {
		fill: rgba(72,138,204,0);
		stroke: rgba(54,95,160,1);
	}
	100% {
		stroke-dashoffset: -25%;
		stroke-dasharray: 50% 0;
		fill: rgba(72,138,204,1);
		stroke: rgba(54,95,160,0);
		stroke-width: 0;
	}
}
728x90
๋ฐ˜์‘ํ˜•

'์• ๋‹ˆ๋ฉ”์ด์…˜' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

CSS์• ๋‹ˆ๋ฉ”์ด์…˜ ์˜ˆ์‹œ  (1) 2022.09.08
์• ๋‹ˆ๋ฉ”์ด์…˜ - CSS  (4) 2022.09.08
์• ๋‹ˆ๋ฉ”์ด์…˜ - SVG  (5) 2022.09.07

๋Œ“๊ธ€