[대구AI스쿨] 개발일지 26일차 210802

102828 단어 CSShtmlCSS

학습내용

1. 네이버 연예뉴스 (1)

1) 연예뉴스 상단

<!-- 연예뉴스 헤더 영역 -->

<header>
	
	<div 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>
				</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>
		
	</div>
</header>

css↓

/* 연예뉴스 ent.html */

.ent-container {
	width: 980px;
	margin: 0 auto;
}

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

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

.ent-flex-end {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

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

.ent-border {
	border: 1px solid #000;
}




/* 연예뉴스 헤더 영역 */

#ent-header {
	width: 100%;
	height: 62px;
	background-color: #fff;
	border-bottom: solid 2px #f1f1f1;

	padding: 20px 25px 0;
}

#ent-header .ent-header-left {

}

#ent-header .ent-header-left ul {

}

#ent-header .ent-header-left ul li {
	font-weight: 700;
}

#ent-header .ent-header-left ul li a {

}

#ent-header .ent-header-left ul li:last-child a {
	color: #9f9f9f;
}

#ent-header .ent-header-left ul li a:before {
	content: '';
	display: inline-block;
	width: 1px;
	height: 12px;
	background-color: #dddddd;

	margin: 0 8px;

	vertical-align: -1px;
}

#ent-header .ent-header-left ul li:first-child a:before {
	content: initial;
}


#ent-header .ent-header-center {

}

#ent-header .ent-header-center ul {

}

#ent-header .ent-header-center ul li {
	font-weight: 700;
	font-size: 16px;
	
	padding: 0 15px;
}

#ent-header .ent-header-center ul li a {
	display: inline-block;
	border-bottom: solid 2px #fff;

	padding-bottom: 2px;
}

#ent-header .ent-header-center ul li.on {
	
}

#ent-header .ent-header-center ul li.on a {
	display: inline-block;
	color: #e24587;

	border-bottom: solid 2px #e24587;
	/* li태그에 넣으면 li의 공간만큼 밑줄이 생기기 때문에 a태그 글자밑에만 밑줄을 넣으려면 a태그에 border-bottom을 넣어준다. */
}


#ent-header .ent-header-right {

}

#ent-header .ent-header-right .btn-login {
	width: 45px;
	height: 20px;
	border: solid 1px #000;

	font-size: 12px;
	line-height: 20px;
	text-align: center;
	margin: 0 9px;
}

#ent-header .ent-header-right .btn-menu {
	width: 16px;
	height: 16px;
	background-color: grey;
	margin: 0 9px;
}

#ent-header .ent-header-right .btn-search {
	width: 25px;
	height: 25px;
	background-color: #000;
	margin-left: 9px;
	/* margin병합현상 : 형제관계의 태그들 사이에서, margin-top, margin-bottom이 겹쳐질 경우에는 margin값이 더 큰 쪽으로 병합되는 현상 */
	/* 하지만 지금 상황과 같이 margin-right, margin-left에서는 적용되지 않는다. */
}


2) 연예뉴스 왼쪽 영역 (1)

<main role="main" id="ent-main">

	<div class="ent-container">

		<!-- 연예뉴스 왼쪽 영역 -->

		<div class="ent-left">
			

			<!-- 연예뉴스 헤드라인 -->

			<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>[신곡 MV] BTS (방탄소년단)......</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>[신곡 MV] BTS (방탄소년단)......</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>[신곡 MV] BTS (방탄소년단)......</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>[신곡 MV] BTS (방탄소년단)......</p>
							</div>
						</a>
					</li>
				</ul>
				
			</div>



			<!-- 연예뉴스 섹션 1 -->

			<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>Title 1</h3>
								<p>동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록 </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>Title 1</h3>
								<p>동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록 동해물과 백두산이 마르고 닳도록 </p>
								
								<div class="bottom-wrap ent-flex-between">
									<span class="source">TV리포트</span>
									<span class="count">9</span>
								</div>
							</div>
						</a>
					</li>

				</ul>

			</div>



			<!-- 연예뉴스 섹션 2 -->

			<div id="ent-section-2">

				<ul class="ent-flex-between">

					<li>
						<a href="#">
							<img src="https://via.placeholder.com/200x122">
							<h3>Title 1 Title 1 Title 1 Title 1</h3>

							<div class="ent-bottom ent-flex-between">
								<span class="source">TV리포트</span>
								<span class="count">1</span>								
							</div>
						</a>
					</li>

					<li>
						<a href="#">
							<img src="https://via.placeholder.com/200x122">
							<h3>Title 1 Title 1 Title 1 Title 1</h3>

							<div class="ent-bottom ent-flex-between">
								<span class="source">TV리포트</span>
								<span class="count">1</span>								
							</div>
						</a>
					</li>

					<li>
						<a href="#">
							<img src="https://via.placeholder.com/200x122">
							<h3>Title 1 Title 1 Title 1 Title 1</h3>

							<div class="ent-bottom ent-flex-between">
								<span class="source">TV리포트</span>
								<span class="count">1</span>								
							</div>
						</a>
					</li>

				</ul>
			</div>



			<!-- 연예뉴스 섹션 3 -->

			<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 class="btn btn-prev"></button>
							<button class="btn btn-next"></button>
						</div>							
					</div>
				</div>

				<ul class="ent-flex-between">

					<li>
						<a href="#">
							<img src="https://via.placeholder.com/148x148">
							<span>에이앤치드</span>
							<h3>[금새록] 오월의 새록</h3>
						</a>
					</li>
					<li>
						<a href="#">
							<img src="https://via.placeholder.com/148x148">
							<span>에이앤치드</span>
							<h3>[금새록] 오월의 새록</h3>
						</a>
					</li>
					<li>
						<a href="#">
							<img src="https://via.placeholder.com/148x148">
							<span>에이앤치드</span>
							<h3>[금새록] 오월의 새록 [금새록] 오월의 새록 [금새록] 오월의 새록</h3>
						</a>
					</li>
					<li>
						<a href="#">
							<img src="https://via.placeholder.com/148x148">
							<span>에이앤치드</span>
							<h3>[금새록] 오월의 새록</h3>
						</a>
					</li>

				</ul>
			</div>
		</div>
		

		<!-- 연예뉴스 오른쪽 영역 -->

		<div class="ent-right">



		</div>

	</div>
</main>

css↓

/* 연예뉴스 메인 */

#ent-main {

}

#ent-main .ent-container {
	overflow: hidden;
	/* 자식의 높이값이 부모의 높이에 영향을 끼치게 하기 위해 */
}



/* 연예뉴스 메인 왼쪽 */

#ent-main .ent-left {
	float: left;
	width: 654px;
	height: 2000px;
	background-color: yellow;

	padding-right: 24px;
}


/* 연예뉴스 헤드라인 */

#ent-main .ent-left #ent-media-headline {
	padding-bottom: 20px;
	border-bottom: solid 1px #f1f1f1;
}

#ent-main .ent-left #ent-media-headline ul {

}

#ent-main .ent-left #ent-media-headline ul li {
	width: 148px;
	height: 204px;
	border-radius: 3px 3px 0 0;
	/* 왼쪽 상단 모서리부터 시계방향으로 */
}

#ent-main .ent-left #ent-media-headline ul li a {
	display: block;
	width: 100%;
	height: 100%;
}

#ent-main .ent-left #ent-media-headline ul li a .media-top {
	position: relative;
	height: 144px;
}

#ent-main .ent-left #ent-media-headline .media-top img {
	position: absolute;
	width: 100%;
	height: 100%;

}

#ent-main .ent-left #ent-media-headline .media-top .time {
	display: block;
	position: absolute;
	height: 16px;
	border-radius: 2px;
	background-color: rgba(0, 0, 0, .56);
	/* 0.56 또는 .56 둘 다 사용이 가능 */

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

	color: #fff;
	font-size: 11px;
	line-height: 16px;
}

#ent-main .ent-left #ent-media-headline .media-top .icon-play {
	display: block;
	position: absolute;

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

	left: 8px;
	bottom: 7px;
}

#ent-main .ent-left #ent-media-headline .media-bottom {
	height: 60px;
	background-color: #444a60;
}

#ent-main .ent-left #ent-media-headline .media-bottom p {
	font-size: 14px;
	font-weight: 700;
	letter-spacing: -1px;
	/* 글자간 좌우 간격을 조정하는 속성 */

	padding: 11px 12px 0;

	color: #fff;
}


/* 연예뉴스 섹션 1 */

#ent-main .ent-left #ent-section-1 {

}

#ent-main .ent-left #ent-section-1 li {
	border-bottom: solid 1px #f1f1f1;
	padding: 20px 0;
}

#ent-main .ent-left #ent-section-1 li a {

}

#ent-main .ent-left #ent-section-1 li a img {
	width: 148px;
	height: 90px;
	border: #000 solid 1px;
}

#ent-main .ent-left #ent-section-1 li a .ent-news-wrap {
	width: 462px;
}

#ent-main .ent-left #ent-section-1 .ent-news-wrap h3 {
	font-size: 14px;
	font-weight: 700;
	margin-bottom: 8px;
}

#ent-main .ent-left #ent-section-1 .ent-news-wrap p {
	margin-bottom: 8px;

	font-size: 12px;
	color: #898989;
	font-weight: 400;
	line-height: 20px;
}

#ent-main .ent-left #ent-section-1 .ent-news-wrap .bottom-wrap {

}

#ent-main .ent-left #ent-section-1 .ent-news-wrap .bottom-wrap .source,
#ent-main .ent-left #ent-section-2 .ent-bottom .source {
	font-size: 12px;
	font-weight: 400;
	color: #a7a7a7;
}

#ent-main .ent-left #ent-section-1 .ent-news-wrap .bottom-wrap .count,
#ent-main .ent-left #ent-section-2 .ent-bottom .count {
	display: inline-block;

	width: 20px;
	height: 20px;
	border: solid 1px #000;
	border-radius: 5px;
	
	text-align: center;
	line-height: 20px;

	font-size: 10px;
}


/* 연예뉴스 섹션 2 */

#ent-main .ent-left #ent-section-2 {
	border-bottom: solid 1px #f1f1f1;
	padding: 20px 0;
}

#ent-main .ent-left #ent-section-2 ul {

}

#ent-main .ent-left #ent-section-2 li {
	width: 200px;
}

#ent-main .ent-left #ent-section-2 a {

}

#ent-main .ent-left #ent-section-2 img {
	width: 200px;
	height: 122px;
	border: solid 1px #000;

	margin-bottom: 20px;
}

#ent-main .ent-left #ent-section-2 h3 {
	font-size: 13px;
	line-height: 20px;

	margin-bottom: 9px;
}

#ent-main .ent-left #ent-section-2 .ent-bottom {

}



/* 연예뉴스 섹션 3 */

#ent-main .ent-left #ent-section-3 {
	padding: 24px 0;
	border-bottom: #e4e4e4 1px solid;
}

#ent-main .ent-left #ent-section-3 .title-wrap {
	margin-bottom: 18px;
}

#ent-main .ent-left #ent-section-3 .title-wrap h3 {
	font-size: 16px;
}

#ent-main .ent-left #ent-section-3 .title-wrap .right-wrap {

}

#ent-main .ent-left #ent-section-3 .title-wrap .right-wrap .count-wrap {

}

#ent-main .ent-left #ent-section-3 .title-wrap .right-wrap .count-wrap span {
	font-size: 12px;
	color: #666;
}

#ent-main .ent-left #ent-section-3 .title-wrap .right-wrap .count-wrap span em {
	font-style: normal;
	color: #ff0080;
}

#ent-main .ent-left #ent-section-3 .title-wrap .right-wrap .button-wrap {
	margin-left: 8px;
}

#ent-main .ent-left #ent-section-3 .title-wrap .right-wrap .button-wrap .btn {
	width: 24px;
	height: 24px;
	border: solid 1px #000;
}

#ent-main .ent-left #ent-section-3 .title-wrap .right-wrap .button-wrap .btn-prev {
	border-right: none;
	background-color: cadetblue;
}

#ent-main .ent-left #ent-section-3 .title-wrap .right-wrap .button-wrap .btn-next {
	background-color: limegreen;
}

#ent-main .ent-left #ent-section-3 ul {

}

#ent-main .ent-left #ent-section-3 ul li {
	width: 148px;
	height: 148px;
	border: 1px solid #000;
}

#ent-main .ent-left #ent-section-3 ul li a {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
}

#ent-main .ent-left #ent-section-3 ul li img {
	position: absolute;

	width: 100%;
	height: 100%;
}

#ent-main .ent-left #ent-section-3 ul li span {
	position: absolute;
	display: block;
	max-width: 100%;
	background-color: #f40080;

	padding: 0 5px;

	left: 0;
	top: 0;

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

	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#ent-main .ent-left #ent-section-3 ul li h3 {
	position: absolute;
	width: 100%;
	min-height: 32px;
	background-color: rgba(0, 0, 0, .3);

	padding: 9px 10px 8px;

	left: 0;
	bottom: 0;

	color: #fff;
	font-size: 12px;
	font-weight: 700;
}


어려웠던 점과 해결방안

  1. 마진 병합현상은 형제태그들의 margin-top과 margin-bottom에서만 적용된다. 형제태그라도 margin-left, margin-right에는 적용되지 않는다.
  2. white-space

    https://opentutorials.org/course/718/3855 생활코딩 참고

학습소감

마진병합현상 같이 초반에 배워서 알고 있다고 생각했는데, 다시 짚어주어서 좋았다.

좋은 웹페이지 즐겨찾기