text-wrap-balance-005.html (1652B)
1 <!DOCTYPE html> 2 <html lang="en" > 3 <meta charset="utf-8"> 4 <title>CSS test: balancing and forced breaks</title> 5 <link rel='author' title='Florian Rivoal' href='https://florian.rivoal.net/'> 6 <link rel='help' href='https://drafts.csswg.org/css-text-4/#text-wrap-style'> 7 <meta name="assert" content="If the element is affected by line-clamp, the claming effect is applied first, then the remaining lines are balanced."> 8 <link rel="match" href="reference/text-wrap-balance-004-a-ref.html"> 9 <link rel="match" href="reference/text-wrap-balance-004-b-ref.html"> 10 <style> 11 div { 12 border: solid; 13 font-family: monospace; 14 margin: 1ch; 15 width: 8.5ch; 16 /* the .5ch above should not be necessary, 17 but in some browsers the ellipsis is a little larger than 1ch, 18 so this gives it room to breathe. 19 Needing this may or may not be a bug, 20 but this is not what we're testing here. 21 */ 22 } 23 .test { 24 border-color: blue; 25 26 text-wrap-style: balance; 27 line-clamp: 2; 28 /* This code is unnecessary in any browser that supports the unprefixed version of line-clamp, 29 but neither does it have any detrimental effect, 30 and it broadens the test to browsers that only support the prefixed version */ 31 32 -webkit-line-clamp: 2; 33 display: -webkit-box; 34 -webkit-box-orient: vertical; 35 overflow: hidden; 36 } 37 .ref1 { 38 border-color: orange; 39 } 40 41 .ref2 { 42 border-color: magenta; 43 } 44 </style> 45 46 <p>Test passes if the box with a blue frame is identical either the orange or magenta one. 47 48 <div class=test>1 2 3 4 5 6 7 8 9 49 </div> 50 51 <div class=ref1>1 2 3 4 5 6 7 8… 52 </div> 53 54 <div class=ref2>1 2 3<br>4 5 6<br>7 8 9</div>