forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstacked-float-example.html
61 lines (61 loc) · 1.63 KB
/
stacked-float-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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>stacking shapes with margins example</title>
<!-- lots of hacks to get this to work with the old shape positioning -->
<style>
body {
width: 250px;
}
.shape {
float: left;
width: 100px;
height: 50px;
background-color: lightblue;
-webkit-shape-outside: polygon(0px 0px, 50px 50px, 0px 50px);
-webkit-clip-path: polygon(0px 0px, 50px 50px, 0px 50px);
}
p {
margin: 0;
}
.content-area {
position: absolute;
top: 28px;
width: 100px;
height: 100px;
background-color: #B29BA3;
z-index: -1;
}
.margin-area {
position: absolute;
width: 100px;
height: 20px;
background-color: #FFF7A5;
z-index: -1;
}
.first {
height: 120px;
-webkit-shape-outside: polygon(0px 70px, 50px 120px, 0px 120px);
-webkit-clip-path: polygon(0px 70px, 50px 120px, 0px 120px);
}
.second {
left: 108px;
}
.second.margin-area {
top: 28px;
}
.second.content-area {
top: 48px;
}
</style>
</head>
<body lang="en">
<div class="margin-area"></div>
<div class="content-area"></div>
<div class="second margin-area"></div>
<div class="second content-area"></div>
<div class="first shape"></div>
<p>When floats with shapes are stacked, the margin box is used for the stacking. Other inline content is only constrained by the shapes themselves and will run through the open content area and <div class="shape"></div> margins outside the shape.</p>
</body>
</html>