๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
CSS

[CSS] ํ†ตํ†ต ํŠ€๋Š” ๊ธ€์ž ํšจ๊ณผ๐Ÿฐ

by ์ฝ”๋”ฉ๊ณต์ฑ… 2022. 9. 22.
๋ฐ˜์‘ํ˜•

ํ†ตํ†ต ํŠ€๋Š” ๊ธ€์ž ํšจ๊ณผ๐Ÿฐ

์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„œ๋Š” ํ†ตํ†ต ํŠ€๋Š” ๊ธ€์ž ํšจ๊ณผ๋ฅผ ๋งŒ๋“ค์–ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!

HTML ์ฝ”๋“œ

h1 ํƒœ๊ทธ ์•ˆ์— ์“ฐ๊ณ  ์‹ถ์€ ๊ธ€์ž ์ˆ˜๋งŒํผ์˜ span ํƒœ๊ทธ๋ฅผ ๋งŒ๋“  ๋‹ค์Œ ๊ธ€์ž๋ฅผ ์ฑ„์›Œ ๋„ฃ๋Š”๋‹ค.

<h1>
  <span>์ฝ”</span>
  <span>๋”ฉ</span>
  <span>๊ณต</span>
  <span>์ฑ…</span>
  <span>โ˜…</span>
  <span>ํ‹ฐ</span>
  <span>์Šค</span>
  <span>ํ† </span>
  <span>๋ฆฌ</span>
</h1>

CSS ์ฝ”๋“œ

@import url('https://webfontworld.github.io/crown/CrownMychew.css');

html, body {
  width: 100%;
  height: 100%;
  
  background: linear-gradient(140deg, skyblue 0%, plum 100%);
  
  display: flex;
  justify-content: center;
  align-items: center;
  
}

h1 {
  height: 100px;
}
h1 span {
  font-family: 'CrownMychew';
  font-size: 110px;
  color: #fff;
  position: relative;
  top: 20px;
  display: inline-block;
  -webkit-font-smoothing: antialiased;
  text-shadow:0 1px 0 #ccc,
              0 2px 0 #ccc,
              0 3px 0 #ccc,
              0 4px 0 #ccc,
              0 5px 0 #ccc,
              0 6px 0 transparent,
              0 7px 0 transparent,
              0 8px 0 transparent,
              0 9px 0 transparent,
              0 10px 0 rgba(0,0,0,0.4);
  animation: bounce 0.3s ease infinite alternate;
}

h1 span:nth-child(2) {animation-delay:0.1s;}
h1 span:nth-child(3) {animation-delay:0.2s;}
h1 span:nth-child(4) {animation-delay:0.3s;}
h1 span:nth-child(5) {animation-delay:0.4s;}
h1 span:nth-child(6) {animation-delay:0.5s;}
h1 span:nth-child(7) {animation-delay:0.6s;}
h1 span:nth-child(8) {animation-delay:0.7s;}
h1 span:nth-child(9) {animation-delay:0.8s;}

@keyframes bounce {
  100% {
    top: -20px;
    text-shadow:0 1px 0 #ccc,
              0 2px 0 #ccc,
              0 3px 0 #ccc,
              0 4px 0 #ccc,
              0 5px 0 #ccc,
              0 6px 0 transparent,
              0 7px 0 transparent,
              0 8px 0 transparent,
              0 9px 0 transparent,
              0 50px 25px rgba(0,0,0,0.4);
  }
}

๊ฒฐ๊ณผ๋ฌผ

๊ธ€์ž๊ฐ€ ์ด๋ ‡๊ฒŒ ํ†ตํ†ต ํŠ„๋‹ค๋ฉด ์„ฑ๊ณต์ž…๋‹ˆ๋‹ค๐Ÿฐ๐Ÿฐ

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€


Reference Book

JavaScript
HTML
CSS
๊ด‘๊ณ  ์ค€๋น„์ค‘์ž…๋‹ˆ๋‹ค.