8월 19일 목

gunho-sung.log·2021년 8월 19일

학습한 내용
트위치 카피캣 새로 시작
상단 헤드 부분 완성

트위치
<nav id="top-nav">

	<div class="nav-wrap">
		
		<div class="nav-left">
			<h1 class="logo">
				<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>



<div class="container">
	<div class="left-area"></div>
	<div class="content"></div>
</div>

  • {
    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;

}

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: #ffffff;
}

.btn-purple {
background-color: #9147ff;
color: #ffffff;
}

.font-purple {
color: #9147ff;
}

.container {
width: 100%;
min-width: 1340px;
}

/상단 네비 영역/
#top-nav {
position: fixed;
width: 100%;
height: 50px;
background-color: #0e0e10;
padding: 0 15px;
}

#top-nav .nav-wrap {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
}

#top-nav .nav-wrap .nav-left {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
}

#top-nav .nav-wrap .nav-left .logo {

}

#top-nav .nav-wrap .nav-left .logo a {

}

#top-nav .nav-wrap .nav-left .logo a img {
width: 24px;
height: 28px;
}

#top-nav .nav-wrap .nav-left ul {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
}

#top-nav .nav-wrap .nav-left ul li {
height: 50px;
font-size: 20px;
padding: 0 20px;
}

#top-nav .nav-wrap .nav-left ul li a {
display: block;
width: 100%;
height: 100%;
line-height: 50px;
}

#top-nav .nav-wrap .nav-left ul li:first-child {
padding-right: 0;
}

#top-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: 8px;

}

#top-nav .nav-wrap .nav-left .more a {
display: block;
font-size: 20px;
height: 50px;

line-height: 50px;
padding-left: 20px;

}

#top-nav .nav-center {
position: absolute;
left: 50%;
transform: translateX(-50%);
}

#top-nav .nav-center .search-wrap {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;

width: 380px;
height: 36px;
background-color: yellow;
overflow: hidden;
border-radius: 5px;

}

#top-nav .nav-center .search-wrap input {
width: calc(100% - 34px);
height: 100%;
background-color: grey;
}

#top-nav .nav-center .search-wrap .btn-search {
width: 34px;
height: 100%;
background-color: darkgrey;
}

#top-nav .nav-right {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
align-items: center;
}

#top-nav .nav-right .mark-wrap {
position: relative;

}

#top-nav .nav-right .mark-wrap .icon-mark {
display: block;
width: 20px;
height: 20px;
background-color: yellow;

cursor: pointer;

}

#top-nav .nav-right .mark-wrap .alarm {
position: absolute;
border-radius: 15px;
background-color: red;
color: #ffffff;
font-size: 14px;

top: -12px;
right: -20px;
padding: 4px 8px 2px;

}

#top-nav .nav-right .btn-login {
width: 53px;
height: 30px;
border-radius: 5px;
background-color: grey;

text-align: center;
line-height: 30px;

margin-left: 20px;

font-size: 12px;

}

#top-nav .nav-right .btn-purple {
width: 53px;
height: 30px;
border-radius: 5px;

text-align: center;
line-height: 30px;

margin-left: 10px;
font-size: 12px;

}

#top-nav .nav-right .btn-profile {
width: 20px;
height: 20px;
background-color: #ffffff;

margin-left: 10px;

}

학습한 내용 중 어려웠던 점 또는 해결못한 것들
문제 1

동그라미 2군데가 탑에 딱 붙어있다.

해결방법 작성
해답 1
일단 플레이스홀더 이미지 주소에 오타가 있었다.

자동완성을 쓰다보니 align- 다음에 items가 아니라 content가 들어갔다.

가로세로 값이 없어야하는데 들어갔다.

완성

학습 소감
새로운 페이즈를 처음 부터 다시 만드니 css 기본값 넣는 부분이 아 이게 있었지라는 생각이 들었다. 그렇지만 상단 부분을 만드는 것은 네이버에서 많이 했기 때문에 이제 대강 3등분해서 어떻게 해야겠다고 구조가 조금 잡히기는 한다. 다만 클래스명을 정하는게 조금 어려운 것 같다.
그리고 오늘은 잠을 잘 못자서 피곤한 상태로 수업을 들어 중간에 가로세로 값을 넣지 말아야할 곳에 넣는 실수를 했다. 그리고 자동완성 기능을 쓰다보니 align-items를 넣어야하는데 align-content 값을 넣었다. ali까지만 치면 자동완성이 뜨는데 당연히 아이템즈인줄 알고 엔터를 눌렀다. 그런데 컨탠트가 더 우선순위였던 것이다. 자동완성을 쓸 떼 편한건 좋은데 꼭 제대로 확인을 해야하는 것을 배웠다.
실습을 보고 따라할 때 사실 그저 보고 따라스는 수준이지만 거기서도 실수가 발생한다. 이렇게 내가 만든 페이지는 오류가 날 때 그냥 원본 소스코드를 복붙하면 편하지만 내가 직접 배껴썼을 지라도 내가 한 실수가 어떤 것인지 알아봄으로서 어디에 주의를 기울여야 할 지 알게되어서 실수를 찾는 부분도 공부가 된다는 것을 느꼈다. 처음에는 이런 과정이 너무 짜증이 났는데 이제는 조금 할만해진 것 같기도 하다.

profile
프로그래밍 초보 입문

0개의 댓글