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