트위치 사이트 상단 네비게이션
github소스코드
--color-text-base
등 최신 브라우저에서만 지원되는 기술 등이 많이 사용되어 알아보기 힘들었다.body {
background-color: #0e0e10;
}
h1, h2, h3, h4, h5, h6, p, span, input, button, a {
color: #ffffff;
}
.btn-purple {
background-color: #9147ff;
color: #ffffff;
}
.font-purple {
color: #9147ff;
}
position:fixed
사용 시 주의점position:fixed
를 적용했더니 nav의 넓이값이 정해져있지 않아서 내부 레이아웃이 전부 틀어지는 문제가 있었다.nav {
position: fixed;
width: 100%;
height: 50px;
background-color: #0e0e10;
padding: 0 15px;
}
<ul>
로 묶고 더보기 부분은 따로 분리해주었다.<ul class="flex-start">
<li><a href="#">탐색</a></li>
<li><a href="#">e스포츠</a></li>
<li><a href="#">음악</a></li>
</ul>
<div class="more">
<a href="#">더보기</a>
</div>
li:first-child a::after
로 적용하였다.nav .nav-wrap .nav-left ul li:first-child {
padding-right: 0;
}
nav .nav-wrap .nav-left ul li:first-child a::after {
display: inline-block;
position: relative;
content: "";
width: 1px;
height: 30px;
background-color: gray;
margin-left: 20px;
top: 8px;
}
border-radius
를 적용할 때 rem이라는 새로운 단위가 등장했다. em과 차이가 크지 않은 단위라고 해서 수치변형사이트 pxtoem을 이용해 단위를 변환해 사용하였다. em, rem 등 새로운 단위에 대해선 따로 찾아봐야 할 것 같다.position:absolute
로 3차원으로 만들어 준 후 x축 중앙정렬 공식을 사용했다.nav .nav-wrap .nav-center {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
background-image
를 이용해 아이콘을 넣어주었는데, 이때 background-position
의 작동 방식에 대해 조금 알게 되었다. 다른 수치 조종값처럼 4가지 값을 넣는 것이 아니고, top, left와 비슷하게 태그 위쪽 기준으로 이동, 태그 왼쪽 기준으로 이동하는 것이었다.nav .nav-wrap .nav-center .search-wrap .btn-search {
width: 34px;
height: 100%;
background: url(../../naver-ex/img/search-white.png) no-repeat;
background-size: 24px;
background-position: 5px;
}
nav .nav-wrap .nav-right .mark-wrap {
position: relative;
}
nav .nav-wrap .nav-right .mark-wrap .icon-mark {
display: block;
width: 20px;
height: 20px;
background-color: greenyellow;
}
nav .nav-wrap .nav-right .mark-wrap .alarm {
position: absolute;
border-radius: 15px;
background-color: red;
padding: 2px 5px;
color: #ffffff;
font-size: 14px;
top: -12px;
right: -12px;
}
<div class="nav-right flex-end">
<div class="mark-wrap">
<i class="icon-mark"></i>
<span class="alarm">44</span>
</div>
<a class="btn-login btn" href="#">로그인</a>
<a class="btn-purple btn-sign-in btn" href="#">회원가입</a>
<button class="btn-profile"></button>
</div>
nav .nav-wrap .nav-right .btn {
width: 60px;
height: 30px;
border-radius: 5px;
text-align: center;
line-height: 30px;
font-size: 12px;
}
nav .nav-wrap .nav-right .btn-login {
margin-left: 20px;
background-color: gray;
color: #ffffff;
}
nav .nav-wrap .nav-right .btn-purple {
margin-left: 10px;
}
거의 한 달 이상 해오던 네이버 페이지를 떠나 새로운 사이트를 카피캣하니 신선한 느낌이 들었다. 어서 강의를 다 듣고 특이한 레이아웃의 사이트를 찾아서 따로 카피캣해보고 싶다.