부모영역에다가 일괄적인 디자인코드를 넣어주면, 코드분량을 간소화 하여 작성할수 있다.
어떤영역의 구역을 나눌때 고정값이 적용 되어있다면, border값은 없는지 고려 하여 작성하여야 한다.
ex)
box width : 400px 이고 border : 1px 라면
box-left width : 199px box-right width :199px
width: auto; : 안에있는 글자 컨텐츠로 width값을 대체(max-width 값을 같이 사용하는것 이좋다.)
카피캣 할려는 네이버쇼핑
네이버쇼핑 왼쪽 상단 완성된 모습
<!-- shop.html언어 -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>네이버</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body id="shop_body">
<header id="shop_header">
<div id="shop_header_top"></div>
<div id="shop_header_middle"></div>
<nav>
<div class="shop_container">
<ul>
<li><a href="#">홈</a></li>
<li><a href="#">백화점</a></li>
<li><a href="#">아울렛</a></li>
<li><a href="#">스타일</a></li>
</ul>
</div>
</nav>
</header>
<main role="main" id="shop_main">
<div class="shop_container">
<div class="list_wrap">
<div class="list_item">
<div class="category_wrap w-100 h-100 shop_border">
<div class="category_left">
<h3>카테고리</h3>
<ul>
<li><a href="#">패션의류</a></li>
<li><a href="#">패션잡화</a></li>
<li><a href="#">화장품/미용</a></li>
<li><a href="#">디지털/가전</a></li>
</ul>
</div>
<div class="category_right">
<div class="category_right_top">
<div class="category_info">
<span class="headline">인기상품</span>
<h3>
견고함의 차이<br>
세라믹 식탁 세트
</h3>
<span class="price">308,800원</span>
</div>
<div class="image_wrap">
<img src="https://via.placeholder.com/140x160">
</div>
</div>
<div class="category_right_bottom">
<span class="headline">추천태그</span>
<div class="tag_wrap">
<span class="tag">#유아마스크</span>
<span class="tag">#하객원피스</span>
<span class="tag">#멀티밤</span>
<span class="tag">#서큘레이터</span>
<span class="tag">#유아마스크</span>
<span class="tag">#하객원피스</span>
<span class="tag">#멀티밤</span>
<span class="tag">#서큘레이터</span>
</div>
</div>
</div>
</div>
</div>
<div class="list_item banner">
<div class="w-100 h-100 shop_border">
<img src="https://via.placeholder.com/150">
</div>
</div>
<div class="list_item"></div>
<div class="list_item"></div>
<div class="list_item"></div>
<div class="list_item"></div>
<div class="list_item"></div>
<div class="list_item"></div>
</div>
</div>
</main>
</body>
</html>
<!-- style.css언어 -->
/* 쇼핑 페이지 */
#shop_body {
background-color: #e9ecef;
}
.shop_container {
width: 1300px;
margin: 0 auto;
}
.shop_border {
border: solid 1px #ced2d7;
}
.w-100{
width: 100%;
}
.h-100{
height: 100%;
}
#shop_header #shop_header_top {
width: 100%;
height: 36px;
background-color: #03c75a;
border-bottom: solid 1px #e8e8e8;
}
#shop_header #shop_header_middle {
width: 100%;
height: 66px;
background-color: #03c75a;
}
#shop_header nav {
width: 100%;
background-color: #ffffff;
border-top: solid 1px #e8e8e8;
border-bottom: solid 1px #e8e8e8;
}
#shop_header nav ul {
display: flex;
flex-wrap: wrap;
align-items: center;
padding: 13px 0 8px 0;
}
#shop_header nav ul li {
margin-right: 16px;
}
#shop_main .list_wrap {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-content: stretch;
}
#shop_main .list_item {
width: 308px;
height: 496px;
background-color: yellow;
margin-bottom: 20px;
}
#shop_main .list_item.banner img {
width: 100%;
height: 100%;
}
#shop_main .list_item .category_wrap {
overflow: hidden;
}
#shop_main .list_item .category_wrap .category_left {
float: left;
width: 124px;
height: 100%;
background-color: #333949;
}
#shop_main .list_item .category_wrap .category_left h3 {
padding: 14px 0 14px 13px;
border-bottom: 1px solid #2b313f;
font-size: 13px;
color: rgba(255, 255, 255, 0.46);
}
#shop_main .list_item .category_wrap .category_left ul{
}
#shop_main .list_item .category_wrap .category_left li {
}
#shop_main .list_item .category_wrap .category_left a {
display: block;
padding: 7px 8px;
font-size: 13px;
color: rgba(255, 255, 255, 0.46);
font-weight: 700;
}
#shop_main .list_item .category_wrap .category_right {
float: right;
width: 182px;
height: 100%;
background-color: #ffffff;
}
#shop_main .list_item .category_wrap .category_right_top {
width: 100%;
height: 306px;
border-bottom: solid 1px #e7e7e7;
text-align: center;
}
#shop_main .list_item .category_wrap .category_right_top .category_info {
padding: 20px 0;
/*text-align: center;*/
}
#shop_main .list_item .category_wrap .category_right_top .headline,
#shop_main .list_item .category_wrap .category_right_bottom .headline {
display: inline-block;
font-size: 12px;
border: solid 1px #00ab33;
color: #00ab33;
margin-bottom: 7px;
}
#shop_main .list_item .category_wrap .category_right_top .category_info h3 {
font-size: 18px;
}
#shop_main .list_item .category_wrap .category_right_top .category_info .price {
font-size: 16px;
color: skyblue;
}
#shop_main .list_item .category_wrap .category_right_top .image_wrap {
/*text-align: center;*/
}
#shop_main .list_item .category_wrap .category_right_bottom {
padding-top: 20px;
text-align: center;
}
#shop_main .list_item .category_wrap .category_right_bottom .tag_wrap .tag {
display: inline-block;
width: auto;
max-width: 80px;
height: 24px;
background-color: #e8eef4;
margin: 6px 1px 0 1px;
padding: 0 5px;
line-height: 26px;
font-size: 12px;
color: #666;
vertical-align: top;
}
코드가 길어지면서 순서가 헷갈리는경우가 많아져 원하는결과 가 한번에 나오지 않았다. 좀더 간소화 하고 직관성을 좋게 하는법을 알아야겠다.
동영상강의를 보면서 하는데 강사님과 같은 수치로 작성하였는데도 원하는값이 나오지 않아 수정하느데 애를 먹었다.
동영상을 보며 그대로 따라해도 아이러니 하게도 원하는값이 나오지 않아, 수치를 달리하니 원하는 결과를 도출할수 있었다. 뭔가 pc설정이 다른지 아님 실수가 있었는지 전체적으로 다시 복기 하여 알아봐야 겠다.