flexbox-multi-row-1e.html (3635B)
1 <!DOCTYPE html> 2 <!-- Any copyright is dedicated to the Public Domain. 3 http://creativecommons.org/publicdomain/zero/1.0/ --> 4 <html> 5 <meta charset="utf-8"> 6 <title>CSS Flexbox Test: Fragmentation of block-size:auto multi-line row flex container with fixed block-size flex items</title> 7 <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> 8 <link rel="author" title="Mozilla" href="http://www.mozilla.org/"> 9 <link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#pagination"> 10 <link rel="match" href="flexbox-multi-row-1-ref.html"> 11 <meta name="assert" content="This test verifies fragmentation of fixed block-size flex items in a block-size:auto multi-line row flex container, with various combinations of margin/border/padding, alignments, and gap. Also use a script to shrink multicol block-size."> 12 13 <style> 14 .multicol { 15 block-size: 80px; 16 inline-size: 200px; 17 column-width: 60px; 18 column-fill: auto; 19 column-gap: 10px; 20 border: 5px solid orange; 21 margin-block-end: 5px; /* Just to separate each sub-testcase visually. */ 22 } 23 .flexContainer { 24 display: flex; 25 flex-wrap: wrap; 26 flex-direction: row; 27 background: gray; 28 /* border-width is 0 by default; some sub-testcases will increase it. */ 29 border: 0 solid lightgray; 30 } 31 .border-padding { 32 border-block-width: 10px; 33 padding-block: 5px; 34 } 35 .with-gap { 36 row-gap: 20px; 37 column-gap: 10px; 38 } 39 40 header, nav, article, footer { 41 inline-size: 30px; 42 } 43 .with-gap header, .with-gap nav, .with-gap article, .with-gap footer { 44 inline-size: 25px; 45 } 46 47 /* Note: flex items are in visual order as "CMYK": cyan, magenta, yellow, black. */ 48 header { 49 background: cyan; 50 block-size: 50px; 51 } 52 nav { 53 background: magenta; 54 block-size: 25px; 55 align-self: flex-start; 56 } 57 article { 58 background: yellow; 59 block-size: 40px; 60 align-self: center; 61 } 62 footer { 63 background: black; 64 block-size: 50px; 65 align-self: flex-end; 66 } 67 68 body.multicol-children-block-size > .multicol { 69 block-size: 50px; 70 } 71 </style> 72 73 <script> 74 function runTest() { 75 document.body.offsetHeight; 76 77 /* Enlarge the multicol's block-size to exercise pulling and pushing flex items 78 of an already fragmented flex container. */ 79 document.body.classList.add("multicol-children-block-size"); 80 } 81 </script> 82 83 <body onload="runTest()"> 84 <!-- Basic one without any margin/border/padding. --> 85 <div class="multicol"> 86 <div class="flexContainer"> 87 <header></header><nav></nav><article></article><footer></footer> 88 </div> 89 </div> 90 91 <!-- Test a container with margin-block-start. --> 92 <div class="multicol"> 93 <div class="flexContainer" style="margin-block-start: 25px"> 94 <header></header><nav></nav><article></article><footer></footer> 95 </div> 96 </div> 97 98 <!-- Test a container not at the top of the column/page. --> 99 <div class="multicol"> 100 <div style="block-size: 25px"></div> 101 <div class="flexContainer"> 102 <header></header><nav></nav><article></article><footer></footer> 103 </div> 104 </div> 105 106 <!-- Test a container with border and padding. --> 107 <div class="multicol"> 108 <div class="flexContainer border-padding"> 109 <header></header><nav></nav><article></article><footer></footer> 110 </div> 111 </div> 112 113 <!-- Test a container with border, padding, and gap. --> 114 <div class="multicol"> 115 <div class="flexContainer border-padding with-gap"> 116 <header></header><nav></nav><article></article><footer></footer> 117 </div> 118 </div> 119 </body> 120 </html>