8월 5일 Velog

류영서·2021년 8월 5일
0

학습한 내용

네이버 게임 실습

https://game.naver.com/

<사이트 특징>

  • css in js : 도구를 사용하여 자바스크립트를 이용해서 css를 적용시키는 방법
    -> 도구에 의한 규칙적인 class를 사용한다.

0. Default

[css]

.game_container {
	width: 1280px;
	margin: 0 auto;
}

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

.game_flex_start {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	align-items: center;
}

.game_flex_end {
display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	align-items: center;
}

.game_flex_center {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
}

.game_shadow {
	box-shadow: 0 2px 30px 0 rgba(0 0 0 / 6%);
}

.game_p_30 {
	padding: 30px;
}

.font_17 {
	font-size: 17px;
	line-height: 17px;
}

.font_19 {
	font-size: 19px;
	line-height: 19px;
}

.font_400 {
	font-weight: 400;
}

#game_body {
	background-color: #f8f9fd;
}

1. Header

구조

[html]


	<header id="game_header">
		<div class="game_container">
			
			<nav></nav>


			<div class="game_event_list"></div>

		</div>
	</header>

[css]

#game_header {
	width: 100%;
	height: 414px;
	background-color: #4e41db;
}

(1) nav

[html]

			<nav class="game_flex_between">
				<div class="game_header_left game_flex_start">
					<h1><a href="index.html">NAVER</a></h1>
					<h2><a href="#">GAME</a></h2>
					<ul class="game_flex_start">
						<li><a href="#">e스포츠</a></li>
						<li><a href="#">PC게임</a></li>
					</ul>
				</div>

				<div class="game_header_right game_flex_end">
					<div class="search_wrap game_flex_start">
						<input type="text" placeholder="라운지, 게시물 검색">
						<button type="button" class="btn_search"></button>
					</div>

					<div class="ticket_wrap">
						<a href="#" class="btn_ticket"></a>
						<p class="bubble_msg">응모 티켓 받고 꿀템 도전!</p>
					</div>

					<a href="#" class="btn_login">로그인</a>
				</div>
			</nav>

[css]

#game_header nav {
	height: 60px;

	vertical-align: middle;

	margin: 0 10px;
}

#game_header .game_header_left h1 {
	font-size: 16px;
}

#game_header .game_header_left h2 {
	font-size: 20px;

	margin-left: 9px;
}

#game_header .game_header_left h1 a,
#game_header .game_header_left h2 a {
	color: #ffffff;
}

#game_header .game_header_left ul li a {
	font-size: 18px;
	color: lightgrey;
}

#game_header .game_header_left ul li a:before {
	content: "";
	display: inline-block;
	width: 1px;
	height: 14px;
	background-color: lightgrey;
	border-radius: 0.5px;

	margin: 0 12px;
	vertical-align: -1px;
}

#game_header .game_header_right .search_wrap {
	width: 300px;
	height: 38px;
	background-color: rgba(0,0,0,.28);
	border-radius: 20px;

	overflow: hidden;
}

#game_header .game_header_right .search_wrap input {
	width: calc(100% - 34px);
	height: 24px;
	background-color: transparent;
	border: none;

	font-size: 15px;
	line-height: 19px;
	color: #ffffff;

	padding: 10px 12px 9px 14px;
}

#game_header .game_header_right .search_wrap input:focus {
	outline: none;
}

#game_header .game_header_right .search_wrap input::placeholder {
	color: lightgrey;
}

#game_header .game_header_right .search_wrap input:focus::placeholder {
	color: transparent;
}

#game_header .game_header_right .search_wrap .btn_search {
	width: 24px;
	height: 24px;
	background-color: lightgrey;
	border: none;
	border-radius: 50%;
}

#game_header .game_header_right .ticket_wrap {
	position: relative;

	width: 40px;
	height: 40px;

	margin-left: 10px;
}

#game_header .game_header_right .ticket_wrap .btn_ticket {
	display: block;

	width: 30px;
	height: 24px;
	border: solid 2px #ffffff;
	border-radius: 5px;

	margin: 7px 5px;
}

#game_header .game_header_right .ticket_wrap .bubble_msg {
	position: absolute;
	
	width: 190px;
	background-color: #697183;
	border-radius: 8px;

	font-size: 14px;
	color: #ffffff;
	font-weight:600;

	padding: 10px 12px;

	/*중앙정렬공식*/
	left: 50%;
	transform: translateX(-50%);

	top: 45px;
	z-index: 100;
}

#game_header .game_header_right .btn_login {
	width: 60px;
	border: solid 1px hsla(0,0%,80%,.3);
	border-radius: 8px;

	font-size: 12px;
	line-height: 15px;
	color: #ffffff;

	padding: 7px 0 6px;
	margin-left: 10px;

	text-align: center;
}

(2) game event list

[html]

			<div class="game_event_list game_flex_between">
				<div class="event_wrap one">
					<div class="event_title_wrap">
						<span>HOT</span>
						<h2>전장의 심장에 서다<br>
						드래곤블러드 사전예약중!</h2>
					</div>
				</div>
				<div class="event_wrap two">
					<div class="event_title_wrap">
						<span>HOT</span>
						<h2>전장의 심장에 서다<br>
						드래곤블러드 사전예약중!</h2>
					</div>
				</div>
				<div class="event_wrap three">
					<div class="event_title_wrap">
						<span>HOT</span>
						<h2>전장의 심장에 서다<br>
						드래곤블러드 사전예약중!</h2>
					</div>
				</div>
			</div>

[css]

#game_header .game_event_list {
	padding: 50px 0;
}

#game_header .game_event_list .event_wrap {
	position: relative;

	width: 407px;
	height: 264px;
	border-radius: 40px;

	top: 0;
	transition: top linear 0.3s;
}

#game_header .game_event_list .event_wrap:hover {
	top: -10px;
}

#game_header .game_event_list .event_wrap.one {
	background-color: #4c2a34;
}

#game_header .game_event_list .event_wrap.two {
	background-color: #2b2e37;
}

#game_header .game_event_list .event_wrap.three {
	background-color: #c2992f;
}

#game_header .game_event_list .event_wrap .event_title_wrap {
	position: absolute;

	left: 30px;
	bottom: 30px;

	color: #ffffff;
}

#game_header .game_event_list .event_wrap .event_title_wrap span {
	display: inline-block;
	/*width값 자동 계산*/

	border: solid 2px #ffffff;
	border-radius: 16px;

	font-size: 12px;
	font-weight: 600;

	text-align: center;
	padding: 2px 6px;
	margin-bottom: 15px;
}

#game_header .game_event_list .event_wrap .event_title_wrap h2 {
	font-size: 20px;
}

2. Main

[html]

	<main role="main" id="game_main">
		<div class="game_container game_flex_between">
			
			<div class="game_main_left"></div>

			<div class="game_main_right"></div>

		</div>
	</main>

[css]

#game_main .game_container {
	align-items: stretch;
}

#game_main .game_main_left {
	width: 900px;
	height: 5000px;
	background-color: lightpink;
}

#game_main .game_main_right {
	width: 358px;
	height: 5000px;
	background-color: lightskyblue;
}
  • #game_main .game_container { align-items: stretch; }
    : game_flex_between에는 align-items: center;

새로 공부한 내용

  1. input 태그의 placeholder 속성값 CSS
  • 색 적용 방법
    : input::placeholder 와 같은 선택자를 사용하여 color css를 적용한다.

  • input 영역 클릭했을 때 텍스트 사라지게 하는 방법 (https://webdir.tistory.com/335)
    : input:focus::placeholder 와 같은 선택자를 사용하여 color로 transparent를 지정한다.

  1. 높이 변화 애니메이션
    : 마우스를 갖다대면 나타나는 효과를 적용하는 hover 선택자를 사용한다.
#game_header .game_event_list .event_wrap {
	position: relative;
	top: 0;
	transition: top linear 0.3s;
}

#game_header .game_event_list .event_wrap:hover {
	top: -10px;
}

0개의 댓글

관련 채용 정보