widows-001.html (2670B)
1 <!DOCTYPE html> 2 3 <meta charset="UTF-8"> 4 5 <title>CSS Fragmentation level 3 Test: 'widows' and content distribution in columns</title> 6 7 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> 8 <link rel="help" href="https://www.w3.org/TR/css-break-3/#widows-orphans"> 9 <link rel="match" href="reference/widows-001-ref.html"> 10 11 <!-- 12 Date created: November 7th 2020 13 Last modified: November 17th 2020 14 --> 15 16 <!-- 17 18 Bug 1562420: Implement orphans and widows for individual columns of a multicolumn element 19 https://bugzilla.mozilla.org/show_bug.cgi?id=1562420 20 21 Bug 137367: Implement orphans and widows 22 https://bugzilla.mozilla.org/show_bug.cgi?id=137367 23 24 --> 25 26 <meta name="assert" content="When column boxes are filled sequentially, their content should be adjusted and fragmented in accordance with the 'widows' declaration. In the test, since the 3rd column box was going to get only 1 line box, then a class B break point is allowed and should occur before the last line box of the 2nd column box and after the next-to-last line box of the 2nd column box so that there is a minimum of 2 line boxes at the top of the 3rd column box."> 27 28 <!-- 29 30 Breaking at a class B break point is allowed only if (...) 31 the number of line boxes between the break and the end 32 of the box is the value of widows or more. 33 4.4 Unforced Breaks 34 https://www.w3.org/TR/css-break-3/#unforced-breaks 35 36 --> 37 38 <style> 39 div 40 { 41 border: orange solid 4px; 42 font-size: 20px; 43 line-height: 1.3; /* computes to 26px */ 44 height: 104px; /* Therefore, exactly 4 line boxes */ 45 margin-bottom: 1em; 46 padding: 0.5em; /* computes to 10px */ 47 width: 490px; 48 49 columns: 3 auto; 50 column-fill: auto; 51 column-gap: 1em; 52 column-rule: blue solid 4px; 53 } 54 55 div#test 56 { 57 widows: 2; /* widows' initial value is 2 */ 58 59 /* 60 "The widows property specifies the minimum number of line boxes of a 61 block container that must be left in a fragment <em>after</em> a 62 column break." 63 64 coming from 65 CSS Fragmentation Module Level 3, section 3.3 Breaks Between Lines: orphans, widows 66 https://www.w3.org/TR/css-break-3/#widows-orphans 67 */ 68 } 69 70 div#reference 71 { 72 widows: 1; 73 } 74 </style> 75 76 <p>Test passes if the digits inside both orange-bordered rectangles are <strong>distributed identically</strong>. 77 78 <div id="test">1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9</div> 79 80 <div id="reference">1<br>2<br>3<br>4<br>5<br>6<br>7<br><br>8<br>9</div> 81 82 <!-- Same as div#test except 1 extra br here ^ -->