728x90
반응형
레이아웃05
float을 이용한 레이아웃이다.
* {
margin: 0;
padding: 0;
}
#wrap {
width: 100%;
margin: 0 auto;
}
#header {
width: 100%;
height: 100px;
background-color: #EEEBE9;
}
#nav {
width: 100%;
height: 100px;
background-color: #B9AAA5;
}
#mian {
width: 100%;
height: 780px;
background-color: #886F65;
}
#footer {
width: 100%;
height: 100px;
background-color: #4E342E;
}
.container {
width: 1200px;
height: inherit;
margin: 0 auto;
background-color: rgba(0, 0, 0, 0.3);
}
.contents .cont1 {
width: 100%;
height: 100px;
background-color: #74574a;
}
.contents .cont2 {
width: 100%;
height: 200px;
background-color: #684D43;
}
.contents .cont3 {
width: 50%;
height: 480px;
background-color: #594139;
float: left;
}
.contents .cont4 {
width: 50%;
height: 480px;
background-color: #4A352F;
float: left;
}
/*
float 으로 인한 영역깨짐 방지법
1.깨지는 영역에 clear:both 를 설정.
2.부모 박스 영역에 overflow: hidden을 설정.
3.clearfix 를 설정한다.
*/
/* clearfix */
.clearfix::before,
.clearfix::after {
content: '';
display: block;
line-height: 0;
}
.clearfix::after {
clear: both;
}
@media (max-width:1220px) {
.container {
width: 96%;
}
.contents .cont1 {
width: 30%;
height: 780px;
float: left;
}
.contents .cont2 {
width: 70%;
height: 390px;
float: left;
}
.contents .cont3 {
width: 35%;
height: 390px;
float: left;
}
.contents .cont4 {
width: 35%;
height: 390px;
float: left;
}
}
@media (max-width:768px) {
.container {
width: 100%;
}
.contents .cont1 {
width: 30%;
height: 780px;
}
.contents .cont2 {
width: 70%;
height: 260px;
}
.contents .cont3 {
width: 70%;
height: 260px;
}
.contents .cont4 {
width: 70%;
height: 260px;
}
}
@media (max-width:480px) {
.container .cont1 {
width: 100%;
height: 150px;
}
.contents .cont2 {
width: 100%;
height: 210px;
}
.contents .cont3 {
width: 100%;
height: 210px;
}
.contents .cont4 {
width: 100%;
height: 210px;
}
}
flex을 이용한 레이아웃이다.
* {
margin: 0;
padding: 0;
}
#wrap {}
#header {
height: 100px;
background-color: #EEEBE9;
}
#nav {
height: 100px;
background-color: #B9AAA5;
}
#main {
height: 780px;
background-color: #886F65;
}
#footer {
height: 100px;
background-color: #4E342E;
}
.container {
width: 1200px;
height: inherit;
background-color: rgba(0, 0, 0, 0.3);
margin: 0 auto;
}
.contents {}
.contents .left {}
.contents .left .con1 {
width: 100%;
height: 100px;
background-color: #74574A;
}
.contents .right {
display: flex;
flex-wrap: wrap;
}
.contents .right .con2 {
width: 100%;
height: 200px;
background-color: #684D43;
}
.contents .right .con3 {
width: 50%;
height: 480px;
background-color: #594139;
}
.contents .right .con4 {
width: 50%;
height: 480px;
background-color: #4A352F;
}
@media (max-width: 1220px) {
.container {
width: 96%;
}
.contents {
display: flex;
flex-wrap: wrap;
}
.contents .left {
width: 30%;
}
.contents .left .con1 {
width: 100%;
height: 780px;
}
.contents .right {
width: 70%;
}
.contents .right .con2 {
width: 100%;
height: 390px;
}
.contents .right .con3 {
width: 50%;
height: 390px;
}
.contents .right .con4 {
width: 50%;
height: 390px;
}
}
@media (max-width: 768px) {
.container {
width: 100%;
}
.contents .right .con2 {
width: 100%;
height: 260px;
}
.contents .right .con3 {
width: 100%;
height: 260px;
}
.contents .right .con4 {
width: 100%;
height: 260px;
}
}
@media (max-width: 480px) {
.contents .left {
width: 100%;
height: 150px;
}
.contents .left .con1 {
width: 100%;
height: 150px;
}
.contents .right {
width: 100%;
height: 630px;
}
.contents .right .con2 {
height: 210px;
}
.contents .right .con3 {
height: 210px;
}
.contents .right .con4 {
height: 210px;
}
}
grid을 이용한 레이아웃이다.
* {
margin: 0;
}
#wrap {}
#header {
height: 100px;
background-color: #EEEBE9;
}
#nav {
height: 100px;
background-color: #B9AAA5;
}
#main {
height: 780px;
background-color: #886F65;
}
#footer {
height: 100px;
background-color: #4E342E;
}
.container {
width: 1200px;
height: inherit;
margin: 0 auto;
background-color: rgba(0, 0, 0, 0.3);
}
.contents {
display: grid;
grid-template-areas:
"cont1 cont1"
"cont2 cont2"
"cont3 cont4"
;
grid-template-columns: 50% 50%;
grid-template-rows: 100px 200px 480px;
}
.contents .cont1 {
background-color: #74574A;
grid-area: cont1;
}
.contents .cont2 {
background-color: #684D43;
grid-area: cont2;
}
.contents .cont3 {
background-color: #594139;
grid-area: cont3;
}
.contents .cont4 {
background-color: #4A352F;
grid-area: cont4;
}
@media (max-width: 1220px) {
.container {
width: 96%;
}
.contents {
display: grid;
grid-template-areas:
"cont1 cont2 cont2"
"cont1 cont3 cont4"
;
grid-template-columns: repeat(3, 1fr);
/* grid-template-columns: 33.333% 33.333% 33.333%;
grid-template-columns: repeat(3, 33.333%);
grid-template-columns: 1fr 1fr 1fr; fr은 공간을 나타내는 단위
grid-template-columns: repeat(3, 1fr); 다양한 방법으로 3등분을 표현할 수 있습니다.*/
grid-template-rows: 390px 390px;
}
}
@media (max-width: 768px) {
.container {
width: 100%;
}
.contents {
display: grid;
grid-template-areas:
"cont1 cont2"
"cont1 cont3"
"cont1 cont4"
;
grid-template-columns: 30% 70%;
grid-template-rows: repeat(3, 1fr);
}
}
@media (max-width: 480px) {
.contents {
grid-template-areas:
"cont1"
"cont2"
"cont3"
"cont4"
;
grid-template-columns: 100%;
grid-template-rows: 150px 210px 210px 210px;
}
}
See the Pen Untitled by 이유나 (@fkdldhs8484) on CodePen.
728x90
댓글