widows-orphans-004.html (1211B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Fragmentation level 3 Test: orphans and line boxes</title> 4 <link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/"> 5 <link rel="help" href="https://drafts.csswg.org/css-break/#widows-orphans"> 6 <link rel="match" href="reference/widows-orphans-001-ref.html"> 7 <meta name="assert" content="The orphans property affects block containers that establish an inline formatting context"> 8 <style> 9 div p { margin: 0; } 10 11 div { 12 columns: 4; 13 column-gap: 0; 14 position: absolute; /* shrinkwrap. Using an explicit width in 'ch' with a monospace font would be fine as well if all UAs supported 'ch', but some don't. */ 15 column-fill: balance-all; /* to make sure it balances as well on paged media */ 16 } 17 div p { 18 widows: 1; /* to avoid interference */ 19 orphans: 2; 20 } 21 22 /* The lines of each paragraphs should be kept together if the orphans property applies, 23 or spread over the 4 columns if it fails to, 24 or all above one-another in a single column if multicol doesn't work. */ 25 26 </style> 27 <body> 28 <p>Test passes if there are 4 “X” characters <strong>arranged in a 2 by 2 square</strong> below. 29 30 <div> 31 <p>X<br>X 32 <p>X<br>X 33 </div> 34 </body>