flexbox-align-self-horiz-004-ref.xhtml (2779B)
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 floated divs 7 in place of flex items and using relative positioning in place of 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 padding: 3px; 17 height: 4px; 18 display: inline-block; 19 font-size: 10px; 20 line-height: 10px; 21 font-family: sans-serif; 22 margin-top: 20px; 23 margin-bottom: 120px; 24 vertical-align: top; 25 } 26 27 .flexbox > div { float: left } 28 .flex-start, .flex-end, .center, .baseline, .stretch, 29 .auto, .unspecified, .initial, .inherit { 30 width: 40px; 31 margin: 1px 2px 3px 4px; 32 border-width: 2px 3px 4px 5px; 33 padding: 3px 4px 5px 6px; 34 position: relative; 35 border-style: dotted; 36 } 37 38 .big { 39 height: 100px; 40 font-size: 20px; 41 line-height: 20px; 42 } 43 44 /* Classes for each of the various align-self values */ 45 .flex-start { 46 background: lime; 47 } 48 .flex-end { 49 background: orange; 50 } 51 .center { 52 background: lightblue; 53 } 54 .baseline { 55 background: teal; 56 } 57 .stretch { 58 background: pink; 59 } 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 c d e f</div> 66 <div class="flex-end" style="top: -24px">end</div> 67 <div class="flex-end big" style="top: -114px">a b c d e f</div> 68 <div class="center" style="top: -12px">center</div> 69 <div class="center big" style="top: -57px">a b c d e f</div> 70 </div> 71 <br/> 72 <div class="flexbox"> 73 <!-- We use inline-blocks inside of a wrapper-block as references for the 74 baseline-aligned flex items, since inline-blocks get 75 baseline-aligned in block layout. We also need to specify the widths 76 manually here since the "flexbox > div" child-selector doesn't 77 handle these guys (since they're grandchildren). 78 --> 79 <div> 80 <div class="baseline" 81 style="display: inline-block">base</div 82 ><div class="baseline big" 83 style="display: inline-block">abc</div> 84 </div> 85 <div class="stretch" style="height: 2px">stretch</div> 86 <div class="stretch big">a b c d e f</div> 87 </div> 88 </body> 89 </html>