-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path07_float.html
More file actions
50 lines (49 loc) · 1.81 KB
/
07_float.html
File metadata and controls
50 lines (49 loc) · 1.81 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Float</title>
</head>
<style>
/* 요새는 안 쓰는 방법 */
.clearfix::after {
content: "";
display: block;
clear: both;
}
/* clear 예시 */
.box {
width: 120px;
height: 120px;
border: 1px black solid;
}
</style>
<body>
<section>
<img style="width: 48px; float: left" src="fish.png" />
<img style="width: 48px; float: left" src="fish.png" />
<img style="width: 48px; float: right" src="fish.png" />
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Ad est vitae
harum assumenda, recusandae ea quam iure, fugiat, consequatur neque ex
mollitia? Quos rem voluptatum recusandae, facere molestiae fuga beatae.
</section>
<section style="border: 1px black solid; overflow: hidden">
<!-- overflow를 auto나 hidden을 주면 자식이 float만 있을 때도 그만큼 height를 가짐 -->
<img style="float: left; width: 48px" src="fish.png" />
</section>
<section style="border: 1px black solid">
<!-- 다른 충돌할 인라인 요소가 있으면 상관이 없는데... 자식이 float 요소밖에 없으면... -->
<!-- <img style="float: left; width: 48px" src="fish.png" /> -->
</section>
<section>
<!-- <div class="box" style="float: left"></div> -->
<div class="box" style="float: right"></div>
<!-- 겹침 -->
<!-- 현재 배치 되는 위치에 있는 라인에 float가 있으면 줄바꿈 -->
<!-- <div class="box" style="clear: left"></div> -->
<!-- <div class="box" style="clear: right"></div> -->
<div class="box" style="clear: both"></div>
</section>
</body>
</html>