HTML & CSS
HTML ID & CLASS 홀리그레일 (holy grail layout)
praybe
2021. 11. 7. 18:04
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
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>홀리그램</title>
<style>
#header {
width: 500px;
background-color: violet;
border: 1px solid #808080;
text-align: center;
}
#wrap {
width: 500px;
background-color: thistle;
border: 2px solid #808080;
text-align: center;
overflow: hidden;
/* 자식에 대해서 집나간 토기를 불러옴*/
}
#content {
width: 350px;
border: 1px solid red;
float: left;
}
#side_banner {
border: 1px solid red;
float: left;
}
#footer{
clear: both;
/*클리어 보스란 더 이상 영향을 안 받겠다는 의미 */
width: 500px;
background-color: violet;
border: 3px solid #808080;
text-align: center;
}
}
.menu1{
color: darkturquoise;
font-weight: bold;
}
.menu2 .menu3 .menu4 .menu5{
font-size: 20px;
}
</style>
</head>
<body>
<!-- -->
<div id="wrap">
<div id="header">
<h1>HEADER</h1>
</div>
</div>
<div id="wrap">
<div id="content">
<h1>CONTENT</h1>
<ul>
<li class="menu1">menu1</li>
<li class="menu2">menu2</li>
<li class="menu3">menu3</li>
<li class="menu4">menu4</li>
<li class="menu5">menu5</li>
</ul>
</div>
<div id="side_banner">
<h1>BANNER</h1>
<a href="http://www.sba.seoul.kr%22" target="_blank">
<img src="http://www.sba.seoul.kr/kr/images/footer/f_logo.png"></a>
</div>
</div>
<div id="footer">
<h1>FOOTER</h1>
</div>
</body>
</html>
|
cs |
style태그 footer 부분에서 clear: both;가 핵심이라고 생각된다.
이것을 하지 않으면 content 부분 레이아웃과 뒤섞여 나와 엉망이 된다.
응용
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
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>홀리그램2</title>
<style>
* {
color: #000000;
}
#wrap {
width: 500px;
background-color: #ffea71;
border: 2px solid #9795ff;
text-align: center;
/*집 나간 토끼를 불러온(밖에 있는 거를 무조건 불러오는 것)*/
overflow: hidden;
}
#content {
width: 300px;
border: 1px solid rgb(70, 20, 20);
float: left;
}
#side_banner {
border: 1px solid rgb(70, 20, 20);
float: right;
}
#footer{
clear: both;
width: 500px;
background-color: #ffb6b6;
border: 3px solid #5f3232;
text-align: center;
}
.menu1{
color: #7fe765;
font-weight: bold;
}
.menu2,.menu3,.menu5{
color: #000000;
font-weight: bold;
}
ul li.menu{
color: #97467c;
font-weight: bold;
font-size: 30px;
}
</style>
</head>
<body>
<div id="wrap">
<div id="header">
<h1>Header</h1>
</div>
</div>
<div id="wrap">
<div id="content">
<h1>CONTENT</h1>
<ul>
<li class="menu1">메뉴1</li>
<li class="menu2">메뉴2</li>
<li class="menu3">메뉴3</li>
<li class="menu4">메뉴4</li>
<li class="menu5">메뉴5</li>
<ul>
<li class="menu">menu1</li>
<li>menu2</li>
<li class="menu">menu3</li>
<li>menu4</li>
<li class="menu">menu5</li>
</ul>
<ol>
<li class="menu">menu1</li>
<li>menu2</li>
<li class="menu">menu3</li>
<li>menu4</li>
<li class="menu">menu5</li>
</ol>
</ul>
</div>
<div id="side_banner">
<h1>BANNER</h1>
<ul>
<a href="http://www.sba.seoul.kr" target="_blank">
<img src="http://www.sba.seoul.kr/kr/images/footer/f_logo.png"></a>
</ul>
</div>
</div>
<div id="footer">
<h1>FOTTER</h1>
</div>
</body>
</html>
|
cs |