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

전체 소스

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 

모바일


<body>부분소스

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<body>
    <div id="header">
        <h1>GOOGLE</h1>
    </div>
    <div id="menu">
        <ul>
            <li id="mn1"><a href="#">menu1</a></li>
            <li id="mn2"><a href="#">menu2</a></li>
            <li id="mn3"><a href="#">menu3</a></li>
            <li id="mn4"><a href="#">menu4</a></li>
        </ul>
    </div>
    <div id="content">
        <div></div>
        <h1>환영합니다</h1>
        <p>한빛 교육센터에 오신것을 환영합니다</p>
        <p>이곳에는 내용이 쏼라쏼라</p><br/>
    </div>
    <div id="footer">
        정책 및 약관|회사소개|광고|마이비즈니스|제휴제안|이용약관|개인정보취급방침|청소년보호정책|고객센터
    </div>
</body>
cs


<head>부분소스

1. 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
44
45
46
47
48
49
50
51
        @media screen and (min-width:1024px){
            /*pc 환경*/
            #header{
                width: 100%;
                height: 80px;
                background-image: url(googlelogo.png);
                background-repeat: no-repeat;
                background-size:180px 70px;
            }
            #header>h1{
                position: absolute;
                left: -999px;
            }
            #menu{
                background-color: lightskyblue;
                overflow: hidden;
            }
            #menu>ul{
                width: 400px;
                margin: 0px auto;
            }
            #menu>ul>li{
                float: left;
                list-style: none;
            }
            #menu>ul>li>a{
                text-decoration: none;
                border-left: solid white 5px;
                border-right: solid white 5px;
                display: inline-block;
                width: 100px;
                height: 30px;
                box-sizing: border-box;
                text-align: center;
                color: floralwhite;
                font-weight: bold;
            }
            #menu>ul>li>a:hover{
                color: royalblue;
            }
            #content{
                clear: both;
            }
            #content>div{
                width: 100%;
                height: 500px;
                background-image: url(jung2.png);
                background-repeat: no-repeat;
                background-size: 100%;
            }
        }
cs

결과


2. 태블릿 환경

소스

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
        @media screen and (min-width:400px) and (max-width:1023px){
            /*태블릿 환경*/
            #header{
                width: 100%;
                height: 80px;
                background-image: url(googlelogo.png);
                background-repeat: no-repeat;
                background-size: 180px 70px;
            }
            #header>h1{
                position: absolute;
                left: -999px;
            }
            #menu>ul>li{
                background-color: darksalmon;
                display: inline-block;
                width: 50%;
                height: 50px;
                border-bottom: solid white 3px;
            }
            #menu>ul>li>a{
                display: inline-block;
                width: 100%;
                height: 100%;
                text-align: center;
                text-decoration: none;
                font-size: 1.5em;
                color: white;
                line-height: 50px;
                font-weight: bold;
                /*text-transform: uppercase;*/
                font-variant: small-caps;
            }
        }
cs

결과


3. 모바일 환경

소스

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
        @media screen and (max-width:399px){
            /*모바일 환경*/
            #header>h1{
                text-align: center;
            }
            #menu>ul{
                /*display: none;*/
            }
            #menu>ul>li{
                background-color: darksalmon;
                border-left: solid red 10px;
                border-bottom: solid white 3px;
            }
             #menu>ul>li>a{
                text-decoration: none;
                color: white;
            }
        }
cs

결과

기준 px를 잡아 모바일 혹은 태블릿의 크기를  @media screen and (max-width:399px) 혹은  @media screen and (min-width:400px)

등으로 잡아 작성한 것이다.

웹창을 늘렸다 줄였다하는 대로 반응하는 반응형 웹이다.


전체소스

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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>반응형 웹</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
        }
        @media screen and (max-width:399px){
            /*모바일 환경*/
            #header>h1{
                text-align: center;
            }
            #menu>ul{
                /*display: none;*/
            }
            #menu>ul>li{
                background-color: darksalmon;
                border-left: solid red 10px;
                border-bottom: solid white 3px;
            }
             #menu>ul>li>a{
                text-decoration: none;
                color: white;
            }
        }
        @media screen and (min-width:400px) and (max-width:1023px){
            /*태블릿 환경*/
            #header{
                width: 100%;
                height: 80px;
                background-image: url(googlelogo.png);
                background-repeat: no-repeat;
                background-size: 180px 70px;
            }
            #header>h1{
                position: absolute;
                left: -999px;
            }
            #menu>ul>li{
                background-color: darksalmon;
                display: inline-block;
                width: 50%;
                height: 50px;
                border-bottom: solid white 3px;
            }
            #menu>ul>li>a{
                display: inline-block;
                width: 100%;
                height: 100%;
                text-align: center;
                text-decoration: none;
                font-size: 1.5em;
                color: white;
                line-height: 50px;
                font-weight: bold;
                /*text-transform: uppercase;*/
                font-variant: small-caps;
            }
        }
        @media screen and (min-width:1024px){
            /*pc 환경*/
            #header{
                width: 100%;
                height: 80px;
                background-image: url(googlelogo.png);
                background-repeat: no-repeat;
                background-size:180px 70px;
            }
            #header>h1{
                position: absolute;
                left: -999px;
            }
            #menu{
                background-color: lightskyblue;
                overflow: hidden;
            }
            #menu>ul{
                width: 400px;
                margin: 0px auto;
            }
            #menu>ul>li{
                float: left;
                list-style: none;
            }
            #menu>ul>li>a{
                text-decoration: none;
                border-left: solid white 5px;
                border-right: solid white 5px;
                display: inline-block;
                width: 100px;
                height: 30px;
                box-sizing: border-box;
                text-align: center;
                color: floralwhite;
                font-weight: bold;
            }
            #menu>ul>li>a:hover{
                color: royalblue;
            }
            #content{
                clear: both;
            }
            #content>div{
                width: 100%;
                height: 500px;
                background-image: url(jung2.png);
                background-repeat: no-repeat;
                background-size: 100%;
            }
        }
    </style>
</head>
<body>
    <div id="header">
        <h1>GOOGLE</h1>
    </div>
    <div id="menu">
        <ul>
            <li id="mn1"><a href="#">menu1</a></li>
            <li id="mn2"><a href="#">menu2</a></li>
            <li id="mn3"><a href="#">menu3</a></li>
            <li id="mn4"><a href="#">menu4</a></li>
        </ul>
    </div>
    <div id="content">
        <div></div>
        <h1>환영합니다</h1>
        <p>한빛 교육센터에 오신것을 환영합니다</p>
        <p>이곳에는 내용이 쏼라쏼라</p><br/>
    </div>
    <div id="footer">
         정책 및 약관|회사소개|광고|마이비즈니스|제휴제안|이용약관|개인정보취급방침|청소년보호정책|고객센터
    </div>
</body>
</html>
cs


+ Recent posts