👉 완성본 보기
<section class="intro">
<div class="intro__dark">
<div class="intro__type">
<div><span aria-hidden="true">😎</span> 코딩이</div>
<div>즐거워진다<span class="underscore">_</span></div>
</div>
</div>
<div class="intro__tilt"></div>
<div class="intro__tilt--flip"></div>
</section>
1-intro.css
1. 사진배경화면
.intro {
position: relative;
background-image: url('../images/intro-bg.jpg');
background-size: cover;
background-position: center;
}
모바일
.intro {
height: 100vh;
}
데스크탑
.intro {
height: 500px;
}
2. 배경 어둡게
/* 배경 이미지를 반투명 검정으로 가리기 */
.intro__dark {
position: absolute;
top: 0; bottom: 0;
left: 0; right: 0;
text-align: center;
background-color: rgba(0, 0, 0, 0.67);
}
3. 타이핑 텍스트
.intro__type {
display: inline-flex;
gap: 0.32em;
font-family: var(--font-code);
font-size: 2.8em;
font-weight: bold;
color: white;
}
모바일
.intro__type {
margin-top: 36vh;
flex-direction: column;
text-align: left;
}
데스크탑
.intro__type {
margin-top: 172px;
align-items: center;
}
.intro__type span {
display: inline-block;
vertical-align: middle;
margin-bottom: 0.25em;
}
4. 깜빡이 애니메이션
@keyframes blink {
from { opacity: 0; }
to { opacity: 1; }
}
.intro__type .underscore {
animation-name: blink;
animation-duration: 350ms;
animation-iteration-count: infinite;
animation-direction: alternate;
}
5. 하단의 빨강 도형들
[class^="intro__tilt"] {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 25%;
background-color: var(--color-main);
clip-path: polygon(100% 90%, 100% 100%, 0 100%, 0 0);
}
.intro__tilt--flip {
clip-path: polygon(100% 0, 100% 100%, 0 100%, 0 90%);
opacity: 0.5;
}