flexbox-align-self-vert-002-ref.xhtml (3285B)
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: 200px; 17 float: left; 18 font-size: 10px; 19 } 20 21 .flex-start, .flex-end, .center, .baseline, .stretch, 22 .self-start, .self-end { 23 clear: both; 24 margin: 1px 2px 3px 4px; 25 border-width: 2px 3px 4px 5px; 26 padding: 3px 4px 5px 6px; 27 border-style: dotted; 28 } 29 30 div.big { 31 font-size: 20px; 32 width: 50px; 33 } 34 35 /* Classes for each of the various align-self values */ 36 .flex-start { 37 background: lime; 38 float: left; 39 } 40 .flex-end { 41 background: orange; 42 float: right; 43 } 44 <!-- We center shrinkwrapped text by putting it into an inline-block, and 45 then wrapping that inline-block in a helper-div that has 46 "text-align:center" set. --> 47 .centerParent { 48 text-align: center; 49 } 50 .center { 51 background: lightblue; 52 display: inline-block; 53 text-align: left; /* Keep parent's centering from tweaking my text */ 54 } 55 .baseline { 56 background: teal; 57 float: left; 58 } 59 .stretch { 60 background: pink; 61 } 62 .self-start { 63 background: yellow; 64 float: right; 65 text-align: right; 66 } 67 .self-end { 68 background: purple; 69 float: left; 70 text-align: right; 71 } 72 .clearFloats { clear: both } 73 </style> 74 </head> 75 <body> 76 <div class="flexbox"> 77 <div class="flex-start">start</div> 78 <div class="flex-start big">a b c d e f</div> 79 <div class="flex-end">end</div> 80 <div class="flex-end big">a b c d e f</div> 81 <div class="clearFloats"></div> 82 <div class="centerParent"> 83 <div class="center">center</div> 84 </div> 85 <div class="centerParent"> 86 <div class="center big">a b c d e f</div> 87 </div> 88 </div> 89 <div class="flexbox"> 90 <div class="baseline">base</div> 91 <div class="baseline big">abc</div> 92 <div class="clearFloats"></div> 93 <div class="stretch">stretch</div> 94 <!-- Force a 3px + 1px = 4px margin between this and the previous div 95 (to thwart the effects of margin-collapsing). This is the only 96 place we need this hack, because everywhere else in this test 97 we use floats or inline-blocks, whose margins don't collapse. --> 98 <div class="stretch big" style="margin-top: 4px">a b c d e f</div> 99 </div> 100 <div class="flexbox"> 101 <div class="self-start">self-start</div> 102 <div class="self-start big">a b c d e f</div> 103 <div class="self-end">self-end</div> 104 <div class="self-end big">a b c d e f</div> 105 </div> 106 </body> 107 </html>