이번 포스팅은 그리드 파일을 이용한 것이 아닌 직접 작성하였다.

전체 소스

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">&nbsp;</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">&nbsp;</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 

모바일


소스

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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link href="css/grid.css" rel="stylesheet" />
    <style>
        
    </style>
    </head>
<body>
    <div class="container_12">
        <div class="grid_1">1</div>
        <div class="grid_1">2</div>
        <div class="grid_1">3</div>
        <div class="grid_1">4</div>
        <div class="grid_1">5</div>
        <div class="grid_1">6</div>
        <div class="grid_1">7</div>
        <div class="grid_1">8</div>
        <div class="grid_1">9</div>
        <div class="grid_1">10</div>
        <div class="grid_1">11</div>
        <div class="grid_1">12</div>
        <!--<div class="grid_1">13</div>-->
        
        <div class="grid_2">1</div>
        <div class="grid_2">2</div>
        <div class="grid_2">3</div>
        <div class="grid_2">4</div>
        <div class="grid_2">5</div>
        <div class="grid_2">6</div>
        
        <div class="grid_3">1</div>
        <div class="grid_3">2</div>
        <div class="grid_3">3</div>
        <div class="grid_3">4</div>
        
        <div class="grid_12">1</div>
        
    </div>
</body>
</html>
cs

결과

결과창은 grid_12 부분의 공간을 보여주는것이다

위의 소스에서 주석처리한부분을 풀어보면 12다음에 13은 아래로 한칸 내려가서 표현된다.


* 해당 파일은 <link href="css/grid.css" rel="stylesheet" /> 가 필요하다. grid.css를 다운받아야 한다.

css.zip

 

공간할당은 아래와 같다.

위에서부터 grid_1,grid_2,,,grid_12 순서이다.


+ Recent posts