|
1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 <!-- |
|
3 Any copyright is dedicated to the Public Domain. |
|
4 http://creativecommons.org/publicdomain/zero/1.0/ |
|
5 --> |
|
6 <!-- Reference case for absolutely positioned children of a flex container. --> |
|
7 <html xmlns="http://www.w3.org/1999/xhtml"> |
|
8 <head> |
|
9 <style> |
|
10 div.containingBlock { |
|
11 top: 15px; |
|
12 left: 20px; |
|
13 height: 400px; |
|
14 position: absolute; |
|
15 border: 2px dashed purple; |
|
16 } |
|
17 .abspos { |
|
18 position: absolute; |
|
19 left: 5px; |
|
20 border: 2px dotted black; |
|
21 } |
|
22 div.flexbox { |
|
23 width: 200px; |
|
24 height: 100px; |
|
25 } |
|
26 div.a { |
|
27 width: 100%; |
|
28 height: 100px; |
|
29 background: lightgreen; |
|
30 display: inline-block; |
|
31 } |
|
32 div.b { |
|
33 width: 100%; |
|
34 height: 100px; |
|
35 background: yellow; |
|
36 display: inline-block; |
|
37 } |
|
38 div.inflex { |
|
39 width: 20px; |
|
40 height: 100px; |
|
41 background: gray; |
|
42 display: inline-block; |
|
43 } |
|
44 div.noFlexFn { |
|
45 width: 15px; |
|
46 height: 15px; |
|
47 background: teal; |
|
48 display: inline-block; |
|
49 } |
|
50 </style> |
|
51 </head> |
|
52 <body> |
|
53 <div class="containingBlock"> |
|
54 <!-- First child abspos: --> |
|
55 <div class="flexbox" |
|
56 ><div class="a abspos" style="width: 30px"/><div class="b"/></div> |
|
57 <!-- Second child abspos: --> |
|
58 <div class="flexbox" |
|
59 ><div class="a"/><div class="b abspos" style="width: 20px"/></div> |
|
60 <!-- Middle child abspos: --> |
|
61 <div class="flexbox" |
|
62 ><div class="a" style="width: 80px" |
|
63 /><div class="inflex abspos" |
|
64 /><div class="b" style="width: 120px"/></div> |
|
65 <!-- Third child abspos, w/ inflexible items & justify-content: space-around: --> |
|
66 <div class="flexbox" |
|
67 ><div class="inflex" style="margin-left: 12px" |
|
68 /><div class="inflex" style="margin-left: 24px" |
|
69 /><div class="inflex" style="margin-left: 24px" |
|
70 /><div class="noFlexFn abspos" |
|
71 /><div class="inflex" style="margin-left: 48px"/></div> |
|
72 </div> |
|
73 </body> |
|
74 </html> |