<nav>
<div class="nav_wrap">
<div class="nav_left">
<h1>
<a href="#">
<img src="https://via.placeholder.com/24x28">
</a>
</h1>
<ul>
<li><a href="#">탐색</a></li>
<li><a href="#">e스포츠</a></li>
<li><a href="#">음악</a></li>
</ul>
<div class="more">
<a href="#">더보기</a>
</div>
</div>
<div class="nav_center">
<div class="search_wrap">
<input type="text" placeholder="검색">
<button class="btn_search"></button>
</div>
</div>
<div class="nav_right">
<div class="mark_wrap">
<i class="icon_mark"></i>
<span class="alarm">44</span>
</div>
<a href="#" class="btn_login">로그인</a>
<a href="#" class="btn_purple">회원가입</a>
<button class="btn_profile"></button>
</div>
</div>
</nav>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
}
body {
background-color: #0e0e10;
}
ol, ul {
list-style: none;
}
a {
text-decoration: none;
color: #fff;
}
img {
vertical-align: top;
}
input {
outline: none;
border: none;
}
button {
outline: none;
border: none;
background: transparent;
}
h1, h2, h3, h4, h5, h6, p, span, input, button, a {
color: #fff;
}
.btn_purple {
background-color: #9147ff;
color: #fff;
}
.font_purple {
oclor: #9147ff;
}
/* header */
nav {
position: fixed;
width: 100%; /* fixed에는 적용 기준이 되는 영역이 필요 */
height: 50px;
background-color: #0e0e10;
padding: 0 15px;
min-width: 1340px;
}
nav .nav_wrap {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
}
nav .nav_wrap .nav_left {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
}
nav .nav_wrap .nav_left .logo a img {
width: 24px;
height: 28px;
}
nav .nav_wrap .nav_left ul {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
}
nav .nav_wrap .nav_left ul li {
height: 50px;
font-size: 20px;
padding: 0 20px;
}
nav .nav_wrap .nav_left ul li a {
display: block;
width: 100%;
height: 100%;
line-height: 50px;
}
nav .nav_wrap .nav_left ul li:first-child {
padding-right: 0;
}
nav .nav_wrap .nav_left ul li:first-child a:after {
position: relative;
display: inline-block;
content: "";
width: 1px;
height: 30px;
background-color: grey;
margin-left: 20px;
top: 7px;
}
nav .nav_wrap .nav_left .more a {
display: block;
height: 50px;
font-size: 20px;
line-height: 50px;
padding-left: 20px;
}
nav .nav_center {
/* flex의 영향을 받지 않음 */
position: absolute;
left: 50%;
transform: translateX(-50%);
}
nav .nav_center .search_wrap {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
width: 380px;
height: 36px;
overflow: hidden;
border-radius: 5px;
}
nav .nav_center .search_wrap input {
width: calc(100% - 34px);
height: 100%;
background-color: gray;
}
nav .nav_center .search_wrap .btn_search {
width: 34px;
height: 100%;
background-color: darkgray;
}
nav .nav_right {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
align-items: center;
}
nav .nav_right .mark_wrap {
position: relative;
}
nav .nav_right .mark_wrap .icon_mark {
display: block;
width: 20px;
height: 20px;
background-color: yellow;
cursor: pointer;
}
nav .nav_right .mark_wrap .alarm {
position: absolute;
border-radius: 15px;
background-color: red;
color: #fff;
font-size: 14px;
padding: 2px 8px 2px;
top: -8px;
right: -15px;
}
nav .nav_right .btn_login {
width: 53px;
height: 30px;
background-color: grey;
border-radius: 5px;
margin-left: 20px;
text-align: center;
line-height: 30px;
font-size: 12px;
}
nav .nav_right .btn_purple {
width: 60px;
height: 30px;
border-radius: 5px;
margin-left: 10px;
text-align: center;
line-height: 30px;
font-size: 12px;
}
nav .nav_right .btn_profile {
width: 20px;
height: 20px;
background-color: #fff;
margin-left: 10px;
cursor: pointer;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.