flexbox-align-self-vert-rtl-003-ref.xhtml (2642B)
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 .baselineParent { 55 float: right; 56 } 57 .baseline { 58 background: teal; 59 float: left; 60 } 61 .stretch { 62 background: pink; 63 } 64 .clearFloats { clear: both } 65 </style> 66 </head> 67 <body> 68 <div class="flexbox"> 69 <div class="flex-start">start</div> 70 <div class="flex-start big">a b</div> 71 <div class="flex-end">end</div> 72 <div class="flex-end big">a b</div> 73 <div class="centerParent clearFloats"> 74 <div class="center">center</div> 75 </div> 76 <div class="centerParent"> 77 <div class="center big">a b</div> 78 </div> 79 <div class="baselineParent"> 80 <div class="baseline">base</div> 81 <div class="baseline big">abc</div> 82 </div> 83 <div class="stretch clearFloats">stretch</div> 84 <div class="stretch big">a b</div> 85 </div> 86 </body> 87 </html>