flexbox-align-self-vert-003-ref.xhtml (2459B)
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 font-family: sans-serif; 18 font-size: 10px; 19 margin-left: 80px; 20 } 21 22 div.big { 23 font-size: 18px; 24 width: 50px; 25 } 26 27 /* Classes for each of the various align-self values */ 28 .flex-start { 29 background: lime; 30 float: left; 31 } 32 .flex-end { 33 background: orange; 34 float: right; 35 } 36 <!-- We center shrinkwrapped text by putting it into an inline-block, and 37 then wrapping that inline-block in a helper-div that has 38 "text-align:center" set. For this to work, the parent has to be at 39 least as wide as the centered content inside of it, so we make it 40 large with a negative margin such that its center aligns with the 41 4px-wide container's center. --> 42 .centerParent { 43 text-align: center; 44 width: 100px; 45 margin-left: -48px; 46 } 47 .center { 48 background: lightblue; 49 display: inline-block; 50 text-align: left; /* Keep parent's centering from tweaking my text */ 51 } 52 .baseline { 53 background: teal; 54 float: left; 55 } 56 .stretch { 57 background: pink; 58 } 59 .clearFloats { clear: both } 60 </style> 61 </head> 62 <body> 63 <div class="flexbox"> 64 <div class="flex-start">start</div> 65 <div class="flex-start big">a b</div> 66 <div class="flex-end">end</div> 67 <div class="flex-end big">a b</div> 68 <div class="centerParent clearFloats"> 69 <div class="center">center</div> 70 </div> 71 <div class="centerParent"> 72 <div class="center big">a b</div> 73 </div> 74 <div class="baseline">base</div> 75 <div class="baseline big">abc</div> 76 <div class="stretch clearFloats">stretch</div> 77 <div class="stretch big">a b</div> 78 </div> 79 </body> 80 </html>