-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGridOfBoxes.html
More file actions
82 lines (73 loc) · 1.52 KB
/
GridOfBoxes.html
File metadata and controls
82 lines (73 loc) · 1.52 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
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
ls<!DOCTYPE html>
<html>
<head>
<style>
* {
box-sizing: border-box;
}
.box {
float: left;
width: 33.33%;
padding: 50px;
}
.clearfix::after {
content: "";
clear: both;
display: table;
}
</style>
</head>
<body>
<h2>Grid of Boxes</h2>
<p>Float boxes side by side</p>
<div class="clearfix">
<div class="box" style="background-color:#bbb">
<p>Some text inside the box.</p>
</div>
<div class="box" style="background-color:#ccc">
<p>Some text inside the box</p>
</div>
<div class="box" style="background-color: #ddd">
<p>Some text inside the box</p>
</div>
</div>
</body>
</html>
<!--Topic: CSS FLOAT-->
<!DOCTYPE html>
<html>
<head>
<style>
* {
box-sizing: border-box;
}
div.img {
float: left;
width: 33.33%;
padding: 5px;
}
.clearfix::after {
content:"";
clear: both;
display: table;
}
</style>
</head>
<body>
<h2>Images side by side</h2>
<p>Float images side by side</p>
<div class="clearfix">
<div class="img">
<img src="small.jpg" alt="painting" style="width:100%;">
</div>
<div class="img">
<img src="small.jpg" alt="painting" style="width:100%;">
</div>
<div class="img">
<img src="small.jpg" alt="painting" style="width:100%;">
</div>
<p>Note that we also use the clearfix hack to take care of the layout flow,
and that we add the box-sizing property to make sure that the image
container doesn't break due to extra padding. Try to remove this code to see the effect.</p>
</body>
</html>