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