이번 포스팅은 그리드 파일을 이용한 것이 아닌 직접 작성하였다.
전체 소스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> *{ margin: 0px; padding: 0px; } .container{ margin: 0px auto; } .grid1,.grid2,.grid3 ,.grid4,.grid5,.grid6 ,.grid7,.grid8,.grid9 ,.grid10,.grid11,.grid12{ float: left; border: 1px red solid; box-sizing: border-box; } @media screen and (max-width:400px){ /*모바일*/ .container{ width: 100%; } .container .mgrid1{width: 8.333%;} .container .mgrid2{width: 16.666%;} .container .mgrid3{width: 25%;} .container .mgrid4{width: 33.333%;} .container .mgrid5{width: 41.666%;} .container .mgrid6{width: 50%;} .container .mgrid7{width: 58.333%;} .container .mgrid8{width: 66.666%;} .container .mgrid9{width: 75%;} .container .mgrid10{width: 83.333%;} .container .mgrid11{width: 91.666%;} .container .mgrid12{width: 100%;} .mrow{clear: both;} .mclear{ display: none; } .mbtn{ width: 80px; height: 80px; border: 1px red solid; box-sizing: border-box; border-radius: 5px; margin: 5px; float: right; background-color: gray; } .mbtn>div{ width: 50px; border: 3px red solid; margin-top: 14px; margin-left: auto; margin-right: auto; } .menu>div:nth-child(3), .menu>div:nth-child(4), .menu>div:nth-child(5), .menu>div:nth-child(6){ display: none; } } @media screen and (min-width:401px){ /*pc용*/ .container{ width: 900px; } .container .grid1{width: 75px;} .container .grid2{width: 150px;} .container .grid3{width: 225px;} .container .grid4{width: 300px;} .container .grid5{width: 375px;} .container .grid6{width: 450px;} .container .grid7{width: 525px;} .container .grid8{width: 600px;} .container .grid9{width: 675px;} .container .grid10{width: 750px;} .container .grid11{width: 825px;} .container .grid12{width: 900px;} .row{clear: both;} } </style> </head> <body> <div class="container"> <div class="header row mrow"> <div class="grid12 mgrid12"> logo img </div> </div> <div class="menu row"> <div class="mrow"> <div class="mgrid12"> <div class="mbtn"> <div></div> <div></div> <div></div> </div> </div> </div> <div class="mrow"> <div class="grid2 mclear"> </div> </div> <div class="mrow"> <div class="grid2 mgrid12"><a href="#">menu1</a></div> </div> <div class="mrow"> <div class="grid2 mgrid12"><a href="#">menu2</a></div> </div> <div class="mrow"> <div class="grid2 mgrid12"><a href="#">menu3</a></div> </div> <div class="mrow"> <div class="grid2 mgrid12"><a href="#">menu4</a></div> </div> <div class="mrow"> <div class="grid2 mclear"> </div> </div> </div> <div class="row"> <div class="mrow"> <div class="content grid9 mgrid12">content</div> </div> <div class="mrow"> <div class="aside grid3 mgrid12">aside</div> </div> </div> <div class="footer row mrow"> <div class="grid12 mgrid12"> 정책 및 약관 | 회사소개 | 광고 | 마이비즈니스 | 제휴제안 | 이용약관 | 개인정보취급방침 | 청소년보호정책 | 고객센터 </div> </div> </div> </body> </html> | cs |
결과
PC
모바일
'* Programming > HTML&CSS' 카테고리의 다른 글
[HTML/CSS] 애니메이션 (0) | 2016.09.27 |
---|---|
[HTML/CSS] 기본적인 웹 화면 만들기 (0) | 2016.09.27 |
[HTML/CSS] 그리드(grid) (0) | 2016.09.27 |
[HTML/CSS] 반응형 웹 (모바일 환경&태블릿 환경&PC 환경) (0) | 2016.09.27 |
[HTML/CSS] 위치 변경하기 (1) | 2016.09.26 |