-
Notifications
You must be signed in to change notification settings - Fork 14
/
grids-and-floats.html
executable file
·56 lines (48 loc) · 1.69 KB
/
grids-and-floats.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Floats interact differently with blocks and grids</title>
<link rel="stylesheet" type="text/css" href="c/grid-baseline.css">
<style type="text/css">
body {width: 70ch;}
section {position: relative;}
.grid {display: grid; width: 200px; height: 100px;
grid-template-rows: repeat(3,1fr); grid-template-columns: repeat(5,1fr);}
.grid.inline {display: inline-grid; width: 100px; height: 70px;}
.float {float: left; border: 2px solid red; background: yellow; width: 30%; margin: 0 1em 1em 1em; padding: 1em;}
.border {border: 2px solid silver;}
</style>
</head>
<body>
<section>
<p class="float">
This is a floated paragraph with some styles applied in order to show its extent.
</p>
<p class="border">
This is a normal-flow paragraph of text with a border. It is followed by a <code>div</code> that’s been made into a grid.
</p>
<div class="grid boxed lines">
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
<span class="gridlines"></span>
</div>
<p>
This is a paragraph that comes after the grid in the normal flow. Notice how the grid does not “slide under” the float, as normal-flow elements do.
</p>
</section>
</body>
</html>