line-clamp-025.tentative.html (1224B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Overflow: when clamping by lines, margins of hidden boxes are ignored</title> 4 <link rel="author" title="Andreu Botella" href="mailto:abotella@igalia.com"> 5 <link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp"> 6 <link rel="match" href="reference/line-clamp-023-ref.html"> 7 <meta name="assert" content="When line-clamp is used with a number of lines, the box and its clamped children should be sized taking margins into account."> 8 <style> 9 .clamp { 10 line-clamp: 4; 11 font: 16px / 32px serif; 12 padding: 4px; 13 background-color: yellow; 14 border: 2px solid black; 15 } 16 .inner { 17 background-color: orange; 18 margin: 4px; 19 /* There is no border, so the margins of the .inner boxes will collapse */ 20 } 21 .inner .inner { 22 white-space: pre; 23 } 24 .clamped-margin { 25 /* These boxes are after the clamp point, so their margins should not affect 26 * the size of their parent boxes. */ 27 background-color: red; 28 margin: 20px; 29 height: 20px; 30 } 31 </style> 32 <div class="clamp"> 33 <div class="inner"> 34 <div class="inner">Line 1 35 Line 2 36 Line 3 37 Line 4 38 Line 5 39 Line 6</div> 40 <div class="clamped-margin"></div> 41 </div> 42 <div class="clamped-margin"></div> 43 </div> 44 <p>Following content.</p>