-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathexample.html
161 lines (157 loc) · 3.81 KB
/
example.html
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<style>
.p,.c {
border: solid 1px;
}
.p {
width: 800px;
position: relative;
padding: 30px;
background: #FFF;
}
.p.full-w {
width: auto;
}
.c {
background: lightyellow;
}
.c.size {
width: 100px;
height: 100px;
box-sizing: border-box;
padding: 5px;
}
.h-100 {
height: 100px;
}
.scroll { overflow-y: scroll; height: 300px; }
.offset { left: 50px; bottom: 50px; }
.top-10 { top: 10px; }
.pos-sta { position: static; }
.pos-rel { position: relative; }
.pos-abs { position: absolute; }
.pos-fix { position: fixed; }
.flex { display: flex; }
.f-1 { flex: 1; }
.f-2 { flex: 2; }
.f-3 { flex: 3; }
.f-c { align-items: center; }
.grid {
display: grid;
grid-template-columns: 100px 1fr 2fr;
gap: 10px;
grid-auto-rows: 50px;
}
.gc {
grid-column: 1 / 3;
grid-row: 2 / 4;
}
.grid-a {
display: grid;
grid-template-areas:
"header header"
"sidebar content"
"footer footer";
grid-template-columns: 100px 1fr;
gap: 20px;
}
header { grid-area: header; }
article { grid-area: content; }
aside { grid-area: sidebar; }
footer { grid-area: footer; }
</style>
<details>
<summary>position 예제</summary>
<div class="p scroll">
this is relative parent
<div class="c size pos-sta offset">
1. static
</div>
<div class="c size pos-rel offset">
2. relative
</div>
<div class="c size pos-abs offset">
3. absolute
</div>
<div class="c size pos-fix offset">
4. fixed
</div>
<div class="c size pos-sta offset">
5. static
</div>
<div class="c size pos-sta offset">
6. static
</div>
<div class="c size pos-sta offset">
7. static
</div>
</div>
</details>
<details>
<summary>normal flow 예제</summary>
<div class="p">
<div class="c">
div는 block입니다.
</div>
<span class="c">
span은 inline입니다.
</span>
inline은 바로 오른쪽에서 계속됩니다. llorem ipsumlorem ipsumorem ipsum
<span class="c">
span은 줄이 넘어가기도 합니다.
</span>
<div class="c">
새로운 block은 다음 줄에 배치됩니다.
</div>
</div>
</details>
<details>
<summary>flexbox 예제</summary>
<h3>flex만 지정한 기본 레이아웃.</h3>
<div class="p flex">
<div class="c">
자식1
</div>
<div class="c">
자식2는 내용이 좀 있어요
</div>
<div class="c size">
자식3은 크기가 있어요
</div>
</div>
<hr>
<h3>자식에 flex 값을 줘보자</h3>
<div class="p flex">
<div class="c f-1">flex: 1</div>
<div class="c f-3">flex: 3</div>
<div class="c f-2">flex: 2</div>
</div>
<hr>
<h3>center로 정렬해보자</h3>
<div class="p flex f-c">
<div class="c f-1">flex: 1</div>
<div class="c size f-3">flex: 3, with size</div>
<div class="c f-2">flex: 2</div>
</div>
</details>
<details>
<summary>grid 예제</summary>
<div class="p grid full-w">
<div class="c"></div>
<div class="c"></div>
<div class="c"></div>
<div class="c"></div>
<div class="c"></div>
<div class="c"></div>
<div class="c"></div>
<div class="c"></div>
<div class="c"></div>
<div class="c"></div>
<div class="c gc">col 1/3, row 2/4</div>
</div>
<div class="p grid-a full-w">
<header class="c">this is header</header>
<article class="c">this is content</article>
<aside class="c h-100">this is sidebar</aside>
<footer class="c">this is footer</footer>
</div>
</details>