|
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 align-items / align-self behavior, using blocks in |
|
7 place of flex items and using float and width keywords to emulate the |
|
8 align-items / align-self properties. --> |
|
9 <html xmlns="http://www.w3.org/1999/xhtml"> |
|
10 <head> |
|
11 <title>CSS Reftest Reference</title> |
|
12 <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/> |
|
13 <style> |
|
14 .flexbox { |
|
15 border: 1px dashed blue; |
|
16 width: 4px; |
|
17 float: left; |
|
18 font-family: sans-serif; |
|
19 font-size: 10px; |
|
20 margin-left: 80px; |
|
21 } |
|
22 |
|
23 .flex-start, .flex-end, .center, .baseline, .stretch { |
|
24 clear: both; |
|
25 margin: 1px 2px 3px 4px; |
|
26 border-width: 2px 3px 4px 5px; |
|
27 padding: 3px 4px 5px 6px; |
|
28 border-style: dotted; |
|
29 } |
|
30 |
|
31 div.big { |
|
32 font-size: 18px; |
|
33 width: 50px; |
|
34 } |
|
35 |
|
36 /* Classes for each of the various align-self values */ |
|
37 .flex-start { |
|
38 background: lime; |
|
39 float: left; |
|
40 } |
|
41 .flex-end { |
|
42 background: orange; |
|
43 float: right; |
|
44 } |
|
45 <!-- We center shrinkwrapped text by putting it into an inline-block, and |
|
46 then wrapping that inline-block in a helper-div that has |
|
47 "text-align:center" set. For this to work, the parent has to be at |
|
48 least as wide as the centered content inside of it, so we make it |
|
49 large with a negative margin such that its center aligns with the |
|
50 4px-wide container's center. --> |
|
51 .centerParent { |
|
52 text-align: center; |
|
53 width: 100px; |
|
54 margin-left: -48px; |
|
55 } |
|
56 .center { |
|
57 background: lightblue; |
|
58 display: inline-block; |
|
59 text-align: left; /* Keep parent's centering from tweaking my text */ |
|
60 } |
|
61 .baseline { |
|
62 background: teal; |
|
63 float: left; |
|
64 } |
|
65 .stretch { |
|
66 background: pink; |
|
67 } |
|
68 .clearFloats { clear: both } |
|
69 </style> |
|
70 </head> |
|
71 <body> |
|
72 <div class="flexbox"> |
|
73 <div class="flex-start">start</div> |
|
74 <div class="flex-start big">a b</div> |
|
75 <div class="flex-end">end</div> |
|
76 <div class="flex-end big">a b</div> |
|
77 <div class="centerParent"> |
|
78 <div class="center">center</div> |
|
79 </div> |
|
80 <div class="centerParent"> |
|
81 <div class="center big">a b</div> |
|
82 </div> |
|
83 </div> |
|
84 <div class="flexbox"> |
|
85 <div class="baseline">base</div> |
|
86 <div class="baseline big">abc</div> |
|
87 <div class="clearFloats"></div> |
|
88 <div class="stretch">stretch</div> |
|
89 <!-- Force a 3px + 1px = 4px margin between this and the previous div |
|
90 (to thwart the effects of margin-collapsing). This is the only |
|
91 place we need this hack, because everywhere else in this test |
|
92 we use floats or inline-blocks, whose margins don't collapse. --> |
|
93 <div class="stretch big" style="margin-top: 4px">a b</div> |
|
94 </div> |
|
95 </body> |
|
96 </html> |