유튜브 전체 영역 나누기, 상단 nav 만들기
github소스코드
#wrapper {
position: relative;
width: 100%;
height: 100%;
min-width: 1320px;
}
#youtube-top-nav {
position: fixed;
width: 100%;
height: 56px;
background-color: #212121;
padding: 0 16px;
}
overflow: scroll
항상 스크롤 있는 속성, auto
필요할 때 스크롤 생기는 속성#youtube-left-nav {
position: fixed;
overflow-y: auto;
overflow-x: hidden;
width: 240px;
background-color: #212121;
top: 56px;
left: 0;
bottom: 0;
}
#youtube-left-content {
position: absolute;
width: 225px;
height: 100%;
background-color: cadetblue;
}
#youtube-main {
position: absolute;
background-color: #181818;
top: 56px;
left: 240px;
right: 0;
bottom: 0;
}
<h1><a class="flex-start" href="#">
<img src="img/youtube-logo-no-letter.png" alt="">
<span>Youtube</span>
</a></h1>
#youtube-top-nav .nav-left h1 img {
width: 20px;
height: 15px;
margin: auto 0;
}
#youtube-top-nav .nav-left h1 span {
display: inline-block;
margin-left: 5px;
letter-spacing: -.5px;
padding-bottom: 2px;
}
#youtube-top-nav .nav-center {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
#youtube-top-nav .nav-center .search-wrap input {
width: calc(100% - 65px);
height: 30px;
border: solid 1px hsl(0deg 0% 21%);
background-color: #212121;
padding: 2px 6px;
font-size: 14px;
color: #ffffff;
}
#youtube-top-nav .nav-center .search-wrap .btn-search {
width: 65px;
height: 30px;
border: solid 1px hsl(0deg 0% 21%);
background-color: hsl(0deg 0% 21%);
}
구조는 트위치와 비슷하지만 이전과 다르게 큰 영역들을 먼저 잡아주고 시작해서 더 효율적이라는 생각이 들었다.