8월 2일 Velog

학습한 내용

네이버 연예 뉴스 실습

https://entertain.naver.com/home

0. Default

[html]

<!DOCTYPE html>
<html>
<head>

	<meta charset="utf-8">

	<link rel="stylesheet" type="text/css" href="css/style.css">

	<title>네이버 TV연예</title>

</head>
<body></body>
</html>

[css]

.ent_container {
	width: 980px;
	margin: 0 auto;
}

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

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

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

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

.ent_border {
	border: solid 1px #000000;
}

1. Header

[html]

	<header id="ent_header">
		<div class="ent_flex_between">
			
			<div class="ent_header_left">
				<ul class="ent_flex_start">
					<li><a href="#">TV연예</a></li>
					<li><a href="news.html">뉴스</a></li>
					<li><a href="#">TOKYO 2020</a></li>
				</ul>
			</div>


			<div class="ent_header_center">
				<ul class="ent_flex_center">
					<li class="on"><a href="#">TV연예홈</a></li>
					<li><a href="#">TV</a></li>
					<li><a href="#">포토</a></li>
					<li><a href="#">랭킹</a></li>
					<li><a href="#">영화</a></li>
					<li><a href="#">최신뉴스</a></li>
				</ul>
			</div>


			<div class="ent_header_right ent_flex_end">
				<a href="#" class="btn_login">로그인</a>
				<button type="button" class="btn_menu"></button>
				<button type="button" class="btn_search"></button>
			</div>

		</div>
	</header>

[css]

#ent_header {
	width: 100%;
	height: 62px;
	background-color: #ffffff;
	border-bottom: solid 2px #f1f1f1;

	padding: 20px 25px 0;
}



#ent_header .ent_header_left ul li {
	font-size: 16px;
	font-weight: 700;
}

#ent_header .ent_header_left ul li a {
	color: #9f9f9f;
}

#ent_header .ent_header_left ul li:first-child a {
	color: black;
} 

#ent_header .ent_header_left ul li a:before {
	content: "";
	display: inline-block;

	width: 1px;
	height: 12px;
	background-color: #dddddd;

	vertical-align: -1px;

	margin: 0 8px;
}

#ent_header .ent_header_left ul li:first-child a:before {
	content: none;
}



#ent_header .ent_header_center ul li {
	font-size: 16px;
	font-weight: 700;

	padding: 0 15px;
}

#ent_header .ent_header_center ul li a {
	border-bottom: solid 2px #ffffff;

	padding-bottom: 2px; -> border와 text 사이의 공백 : 위치 중요!!!!
}

#ent_header .ent_header_center ul li.on a {
	color: #e2458f;
	border-bottom: solid 2px #e2458f;
}



#ent_header .ent_header_right .btn_login {
	width: 45px;
	height: 20px;
	border: solid 1px grey;

	font-size: 12px;

	text-align: center;
	line-height: 20px;
}

#ent_header .ent_header_right .btn_menu {
	width: 16px;
	height: 16px;
	background-color: grey;

	margin-left: 18px;
}

#ent_header .ent_header_right .btn_search {
	width: 25px;
	height: 25px;
	background-color: black;

	margin-left: 18px;
}

2. Main

[html]

	<main role="main" id="ent_main">
		<div class="ent_container">
			
			<div class="ent_main_left"></div>
            <div class="ent_main_right"></div>

		</div>
	</main>

[css]

#ent_main {
	padding-top: 0;
}

#ent_main .ent_container {
	overflow: hidden;

	border-bottom: 1px solid #e8e8e8;
}

#ent_main .ent_main_left {
	float: left;

	width: 654px;

	padding-right: 24px;
    padding-top:20px
}

#ent_main .ent_main_right {
	float: right;

	width: 324px;
    
    padding-top: 20px;
	padding-left: 24px;
}

3. Main Left

구조

[html]

			<div class="ent_main_left">

				<div id="ent_media_headline"></div>


				<div id="ent_section_1"></div>


				<div id="ent_section_2"></div>


				<div id="ent_section_3"></div>

	
			</div>

(1) ent main headline

[html]

				<div id="ent_media_headline">
					<ul class="ent_flex_between">
						<li>
							<a href="#">
								<div class="media_top">
									<img src="https://via.placeholder.com/148x145">
									<span class="time">03:02</span>
									<i class="icon_play"></i>
								</div>

								<div class="media_bottom">
									<p>[tvN 악마판사] "너 원래 하녀…</p>
								</div>
							</a>
						</li>
						<li>
							<a href="#">
								<div class="media_top">
									<img src="https://via.placeholder.com/148x145">
									<span class="time">03:02</span>
									<i class="icon_play"></i>
								</div>

								<div class="media_bottom">
									<p>[tvN 악마판사] "너 원래 하녀…</p>
								</div>
							</a>
						</li>
						<li>
							<a href="#">
								<div class="media_top">
									<img src="https://via.placeholder.com/148x145">
									<span class="time">03:02</span>
									<i class="icon_play"></i>
								</div>

								<div class="media_bottom">
									<p>[tvN 악마판사] "너 원래 하녀…</p>
								</div>
							</a>
						</li>
						<li>
							<a href="#">
								<div class="media_top">
									<img src="https://via.placeholder.com/148x145">
									<span class="time">03:02</span>
									<i class="icon_play"></i>
								</div>

								<div class="media_bottom">
									<p>[tvN 악마판사] "너 원래 하녀…</p>
								</div>
							</a>
						</li>
					</ul>
				</div>

[css]

#ent_main .ent_main_left #ent_media_headline {
	padding-bottom: 20px;
	border-bottom: solid 2px #f1f1f1;
}

#ent_media_headline ul li {
	width: 148px;
	height: 204px;
	border-radius: 10px;
}

#ent_media_headline ul li a {
	display: block;

	width: 100%;
	height: 100%;
}

#ent_media_headline ul li a .media_top {
	position: relative;  -> 자식 태그들의 레이어를 지정하기 위한 작업

	height: 144px;
}

#ent_media_headline .media_top img {
	position: absolute;

	width: 100%;
	height: 100%;
}

#ent_media_headline .media_top .time {
	position: absolute;
	display: block;

	height: 16px;
	background-color: rgba(0, 0, 0, 0.56);
	/*0.56 대신에 .56만 넣어도 된다.*/
	border-radius: 2px;

	font-size: 11px;
	color: #ffffff;

	line-height: 16px;

	padding: 0 4px;
	right: 8px;
	top: 8px;
}

#ent_media_headline .media_top .icon_play {
	position: absolute;
	display: block;

	width: 28px;
	height: 28px;
	background-color: grey;
	border-radius: 50%;

	left: 8px;
	bottom: 7px;
}


#ent_media_headline ul li a .media_bottom {
	height: 60px;
	background-color: #444a60;
}

#ent_media_headline .media_bottom p {
	font-size: 14px;
	font-weight: 700;
	color: #ffffff;
	letter-spacing: -1px; -> 글자 간 좌우 간격 조절

	padding: 11px 12px 0;
}

(2) ent section 1

[html]

				<div id="ent_section_1">
					<ul>
						<li>
							<a href="#" class="ent_flex_between">
								<img src="https://via.placeholder.com/148x90">
								<div class="ent_news_wrap">
									<h3>제임스 건이 밝힌 '더 수어사이드 스쿼드'</h3>
									<p>"이 영화가 DC 세계관을 더 매력적으로 만들 수 있을 거라고 생각합니다." '더 수어사이드 스쿼드' 개봉을 앞둔 제임스 건 감독은 에너지가 넘쳤다.</p>
									<div class="bottom_wrap ent_flex_between">
										<span class="source">TV리포트</span>
										<span class="count">9</span>
									</div>
								</div>
							</a>
						</li>
						<li>
							<a href="#" class="ent_flex_between">
								<img src="https://via.placeholder.com/148x90">
								<div class="ent_news_wrap">
									<h3>제임스 건이 밝힌 '더 수어사이드 스쿼드'</h3>
									<p>"이 영화가 DC 세계관을 더 매력적으로 만들 수 있을 거라고 생각합니다." '더 수어사이드 스쿼드' 개봉을 앞둔 제임스 건 감독은 에너지가 넘쳤다.</p>
									<div class="bottom_wrap ent_flex_between">
										<span class="source">TV리포트</span>
										<span class="count">9</span>
									</div>
								</div>
							</a>
						</li>
					</ul>
				</div>

[css]

#ent_main .ent_main_left #ent_section_1 ul li {
	border-bottom: solid 1px #f1f1f1;

	padding: 20px 0;
}

#ent_section_1 ul li a img {
	width: 148px;
	height: 90px;
	border: solid 1px #000000;
}

#ent_section_1 ul li a .ent_news_wrap {
	width: 462px;
}

#ent_section_1 .ent_news_wrap h3 {
	font-size: 14px;
	font-weight: 700;

	margin-bottom: 8px;
}

#ent_section_1 .ent_news_wrap p {
	font-size: 12px;
	color: #898989;
	font-weight: 400;

	line-height: 20px;

	margin-bottom: 8px;
}

#ent_section_1  .ent_news_wrap .bottom_wrap .source,
#ent_section_2 .bottom_wrap .source {
	font-size: 11px;
	font-weight: 400;
	color: #a7a7a7;
}

#ent_section_1  .ent_news_wrap .bottom_wrap .count,
#ent_section_2 .bottom_wrap .count {
	display: inline-block;

	width: 20px;
	height: 20px;
	border: solid 1px #000000;
	border-radius: 5px;

	text-align: center;
	line-height: 18px; -> 위치가 안 맞아서 내 임의로 20px에서 18px로 바꿈

	font-size: 10px;
}

(3) ent section 2

[html]

				<div id="ent_section_2">
					<ul class="ent_flex_between">
						<li>
							<a href="#">
								<img src="https://via.placeholder.com/200x122">
								<h3>'최파타' 허준호 "김윤석과 첫 만남? 설레는 마음에 계속 …</h3>
								<div class="bottom_wrap ent_flex_between">
									<span class="source">OSEN</span>
									<span class="count">1</span>
								</div>
							</a>
						</li>
						<li>
							<a href="#">
								<img src="https://via.placeholder.com/200x122">
								<h3>'최파타' 허준호 "김윤석과 첫 만남? 설레는 마음에 계속 …</h3>
								<div class="bottom_wrap ent_flex_between">
									<span class="source">OSEN</span>
									<span class="count">1</span>
								</div>
							</a>
						</li>
						<li>
							<a href="#">
								<img src="https://via.placeholder.com/200x122">
								<h3>'최파타' 허준호 "김윤석과 첫 만남? 설레는 마음에 계속 …</h3>
								<div class="bottom_wrap ent_flex_between">
									<span class="source">OSEN</span>
									<span class="count">1</span>
								</div>
							</a>
						</li>
					</ul>
				</div>

[css]

#ent_main .ent_main_left #ent_section_2 {
	border-bottom: 1px solid #f1f1f1;

	padding: 20px 0;
}

#ent_section_2 ul li {
	width: 200px;
}

#ent_section_2 ul li a img {
	width: 200px;
	height: 122px;
	border: solid 1px #000000;
}

#ent_section_2 ul li a h3 {
	font-size: 13px;

	line-height: 20px;

	padding: 15px 0 9px;
}

#ent_section_2 .bottom_wrap .source,
#ent_section_2 .bottom_wrap .count {
	/*위의 CSS에 추가로 적용*/
}

(4) ent section 3

[html]

				<div id="ent_section_3">
					<div class="title_wrap ent_flex_between">
						<h3>스타 콘텐츠</h3>

						<div class="right_wrap ent_flex_end">
							<div class="count_wrap">
								<span><em>1</em> / 2</span>
							</div>
							<div class="button_wrap ent_flex_end">
								<button type="button" class="btn btn_prev"></button>
								<button type="button" class="btn btn_next"></button>
							</div>
						</div>
					</div>


					<ul class="ent_flex_between">
						<li>
							<a href="#">
								<img src="https://via.placeholder.com/148">
								<span>ACE FACTORY</span>
								<h3>소속사가 자랑하는 연기 천재</h3>
							</a>
						</li>
						<li>
							<a href="#">
								<img src="https://via.placeholder.com/148">
								<span>ACE FACTORY</span>
								<h3>소속사가 자랑하는 연기 천재</h3>
							</a>
						</li>
						<li>
							<a href="#">
								<img src="https://via.placeholder.com/148">
								<span>ACE FACTORY</span>
								<h3>소속사가 자랑하는 연기 천재</h3>
							</a>
						</li>
						<li>
							<a href="#">
								<img src="https://via.placeholder.com/148">
								<span>ACE FACTORY</span>
								<h3>소속사가 자랑하는 연기 천재</h3>
							</a>
						</li>
					</ul>
				</div>

[css]

#ent_main .ent_main_left #ent_section_3 {
	border-bottom: solid 1px #e4e4e4;

	padding: 24px 0;
}

#ent_section_3 .title_wrap {
	margin-bottom: 18px;
}

#ent_section_3 .title_wrap h3 {
	font-size: 16px;
}

#ent_section_3 .title_wrap .right_wrap .count_wrap span {
	font-size: 12px;
	color: #666;
}

#ent_section_3 .title_wrap .right_wrap .count_wrap span em {
	font-style: normal;
	color: #ff0080;
}

#ent_section_3 .title_wrap .right_wrap .button_wrap {
	margin-left: 8px;
}

#ent_section_3 .title_wrap .right_wrap .button_wrap .btn {
	width: 24px;
	height: 24px;
	border: solid 1px #000000;
}

#ent_section_3 .title_wrap .right_wrap .button_wrap .btn.btn_prev {
	background-color: grey;
	border-right: none;
}

#ent_section_3 .title_wrap .right_wrap .button_wrap .btn.btn_next {
	background-color: black;
}

#ent_section_3 ul li {
	width: 150px;
	height: 150px;
	border: solid 1px #000000;
}

#ent_section_3 ul li a {
	position: relative;
	display: block;

	width: 100%;
	height: 100%;
}

#ent_section_3 ul li  a img {
	position: absolute;
}

#ent_section_3 ul li a span {
	position: absolute;
	display: block;

	height: 19px;
	background-color: #f40080;

	font-size: 11px;
	font-weight: 700;
	color: #ffffff;

	line-height: 19px;

	padding: 0 5px;

	top: 0;
	left: 0;

	/*실무TIP : 말줄임표코드
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;*/
}

#ent_section_3 ul li a h3 {
	position: absolute;

	width: 100%;
	min-height: 32px;
	background-color: rgba(0, 0, 0, 0.3);

	font-size: 12px;
	font-weight: 700;
	color: #ffffff;

	padding: 9px 10px 8px;

	left: 0;
	bottom: 0;
}

개념 추가로 익히기

  1. 말줄임표 CSS
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
  1. border-radius
  • 속성값 순서 차례대로 : top-left, top-right, bottom-right, bottom-left

좋은 웹페이지 즐겨찾기