기본&그리드 이용한 웹 화면 만들기


1. 그리드를 사용하지 않은 웹 화면

소스

<body>부분에는 구성을 보여준다

우선 header부분으로 로고 이미지를 넣고

menu부분에 메뉴를 4개를 넣어 a태그로 설정했다.

그리고 왼쪽은 서브메뉴의 공간, 중앙엔 메인 내용, 오른쪽은 광고란으로 구성하고

제일 하단에 footer부분으로 웹 화면을 구성한다.

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
<body>
   <div>
        <div id="header">
            <img alt="" src="googlelogo.png" />
        </div>
        <div id="menu">
            <ul>
                <li><a href="#">menu1</a></li>
                <li><a href="#">menu2</a></li>
                <li><a href="#">menu3</a></li>
                <li><a href="#">menu4</a></li>
            </ul>
        </div>
        <div id="clear"></div>
        <div id="submenu">
            서브메뉴
        </div>
        <div id="content">
            <img alt="" src="jung.png" />
            <h1>환영합니다</h1>
            <p>정우성입니다.. :)</p>
            <br/>
        </div>
        <div id="aside">
            광고
        </div>
        <div id="footer">
            오픈 API | 이용약관 | 개인정보취급방침 | 청소년보호정책 | 권리침해신고 | 고객센터 | E-mail수집거부정책
        <br/> Copyright ©  Corp. All rights reserved.
        </div>
    </div>
</body>
cs

<style>부분의 소스이다

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
<head>
    <meta charset="utf-8">
    <style>
        *{
            padding: 0px;
            margin: 0px;
        }
        body>div{
            width: 85%;
            margin: 0px auto;
        }
        #header>img{
            height: 80px;
            width: auto;
            margin: 10px;
        }
        #menu{
            background-color: antiquewhite;
            height: 50;
        }
        #menu>ul{
            width: 430px;
            margin-left: auto;
            margin-right: auto;
        }
        #menu>ul>li{
            float: left;
            list-style: none;
            margin-top: 5px;
            margin-right: 10px;
            margin-bottom: 5px;
        }
         #menu>ul>li:last-child{
            margin-right: 0px;
        }
        #menu>ul>li>a{
            display: inline-block;
            background-color: tomato;
            height: 40px;
            width: 100px;
            border-radius: 5px;
            text-align: center;
            line-height: 40px;
            text-decoration: none;
            color: white;
            font-size: 20px;
            font-weight: bold;
        }
        #clear{
            clear: both;
        }
        #menu>ul>li>a:hover{
            background-color: brown;
        }
        #submenu,#content,#aside{
            float: left;
        }
        #submenu{
            background-color: antiquewhite;
            width: 20%;
        }
        #content{
            width: 60%;
        }
        #content>img{
            width: 100%;
            height: auto;
        }
        #aside{
            background-color: antiquewhite;
            width: 20%;
        }
        #footer{
            clear: both;
            background-color: gainsboro;
        }
    </style>
</head>
cs

결과

하단 부분입니다.


2. 그리드를 사용한 웹 화면

소스

그리드를 이용하기위하여 <link href="css/grid.css" rel="stylesheet" /> 가 필요하다.

<body>부분의 구성은 위의 구성과 동일하게 작성하였다.

<div class="clear"></div> 부분이 추가됨을 확인 할 수 있다.

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
<body>
    <div class="container_12">
        <div class="header grid_12">
            <img alt="" src="googlelogo.png" />
        </div>
        <div class="clear"></div>
 
        <div class="menu push_2">
        <div class="grid_2">menu1</div>
        <div class="grid_2">menu2</div>
        <div class="grid_2">menu3</div>
        <div class="grid_2">menu4</div>
        </div>
        <div class="clear"></div>
        
        <div class="menu2 grid_3">서브메뉴</div>
        
        <div class="content grid_6">
            <img alt="" src="jung2.png"/>
            <h1>환영합니다.</h1>
        </div>
        
        <div class="aside grid_3">광고</div>
        <div class="clear"></div>
        
        <div class="footer grid_12">
            사이트 정책 및 약관 | 회사소개 | 광고 | 마이비즈니스 | 제휴제안 | 이용약관 | 개인정보취급방침 | 청소년보호정책 | 고객센터
        </div>
        <div class="clear"></div>
    </div>
</body>
cs

<style>부분의 소스이다

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<head>
    <meta charset="UTF-8">
    <title>grid system</title>
    <link href="css/grid.css" rel="stylesheet" />
    <style>
        .header>img{
            width: auto;
            height: 80px;
        }
        .content>img{
            width: 100%;
            height: auto;
        }
        .menu2,.aside{
            background-color: antiquewhite;
        }
    </style>
</head>
cs

결과



소스


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
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <style>
        body{
            margin: 0px;
            padding: 10px;
        }
        #logo{
            width: auto;
            height: 80px;
        }
        #main{
            width: 100%;
            height: auto;
        }
        #page1{
            width: 80%;
            margin: auto;
        }
        #content,#aside{
            display: inline-block;
            padding: 0px;
            border-width: 0px;
            margin: 0px;
        }
        #content{
            margin: 5px;
            width: 80%;
        }
        #aside{
            width: 8%;
        }
        ul{
            padding: 0px;
            width: 500px;
            margin: auto;
        }
        li{
            display: inline-block;
            width: 100px;
            background-color: azure;
            margin: 10px;
        }
        #menu{
            background-color: cornsilk;
        }
        a{
            display: inline-block;
            width: 100px;
            height: 30px;
            text-align: center;
            text-decoration: none;
            color: black;
        }
        a:hover{
            background-color: cornflowerblue;
            color: white;
        }
    </style>
</head>
<body>
  <div id="page1">
       <div id="header">
           <img id="logo" alt="" src="googlelogo.png" />
       </div>
       <div id="menu">
           <ul>
               <li><a href="#">menu1</a></li>
               <li><a href="#">menu2</a></li>
               <li><a href="#">menu3</a></li>
               <li><a href="#">menu4</a></li>
           </ul>
       </div>
       <div>
           <div id="content">
               <img id="main" alt="" src="jung.png"/>
           </div>
            <div id="aside">
               광고란
           </div>
       </div>
       <div id="footer">
           오픈 API | 이용약관 | 개인정보취급방침 | 청소년보호정책 | 권리침해신고 | 고객센터 | E-mail수집거부정책
           <br/> Copyright © Kakao Corp. All rights reserved.
        </div>
   </div>
</body>
</html>
cs


결과



*참고 , 이미지파일은 같은 폴더 내에 가지고 있으면 된다.


+ Recent posts