tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

text-wrap-balance-line-clamp-003.html (1877B)


      1 <!DOCTYPE html>
      2 <html lang="en" >
      3 <meta charset="utf-8">
      4 <title>CSS test: balancing and line-clamp</title>
      5 <link rel='author' title='Andreu Botella' href='mailto:abotella@igalia.com'>
      6 <link rel='help' href='https://drafts.csswg.org/css-overflow-4/#line-clamp'>
      7 <link rel='help' href='https://drafts.csswg.org/css-text-4/#text-wrap-style'>
      8 <meta name="assert" content="If the element is affected by line-clamp, the clamping effect is applied first, then the remaining lines are balanced. If the last line is displaced by the line-clamp ellipsis, the content of the previous lines should be balanced into the displaced line if possible.">
      9 <link rel="match" href="reference/text-wrap-balance-line-clamp-003-ref.html">
     10 <style>
     11 div {
     12    border: solid;
     13    font-family: monospace;
     14    margin: 1ch;
     15    width: 9.1ch;  /* .1ch to work around browser bugs */
     16 }
     17 .test {
     18    border-color: blue;
     19 
     20    text-wrap-style: balance;
     21    line-clamp: 3;
     22    /* This code is unnecessary in any browser that supports the unprefixed version of line-clamp,
     23       but neither does it have any detrimental effect,
     24       and it broadens the test to browsers that only support the prefixed version */
     25 
     26    -webkit-line-clamp: 3;
     27    display: -webkit-box;
     28    -webkit-box-orient: vertical;
     29    overflow: hidden;
     30 }
     31 .ref {
     32    border-color: orange;
     33 }
     34 </style>
     35 
     36 <p>Test passes if the box with a blue frame is identical to the orange one.
     37 
     38 <div class=test>1 2 3 4 5 6 7 8 9 unbreakable stuff</div>
     39 
     40 <div class=ref>1 2 3<br>4 5 6<br>7 8 9…</div>
     41 
     42 <!--
     43 unbalanced layout without clamping:
     44    |---------|
     45    |1 2 3 4 5|
     46    |6 7 8 9  |
     47    |unbreakable
     48    |stuff    |
     49    |---------|
     50 
     51 unbalanced layout after clamping:
     52    |---------|
     53    |1 2 3 4 5|
     54    |6 7 8 9  |
     55    |…        |
     56    |---------|
     57 
     58 balanced layout:
     59    |---------|
     60    |1 2 3    |
     61    |4 5 6    |
     62    |7 8 9…   |
     63    |---------|
     64 -->