line-clamp-024.tentative.html (1283B)
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-022-ref.html"> 7 <meta name="assert" content="When line-clamp is used with a number of lines, the margins of boxes after the clamp point should not affect the sizing of boxes."> 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: purple; 18 margin: 4px; 19 /* Having a border means the margins of the .inner boxes won't collapse */ 20 border: 1px solid black; 21 } 22 .inner .inner { 23 background-color: orange; 24 white-space: pre; 25 } 26 .clamped-margin { 27 /* These boxes are after the clamp point, so their margins should not affect 28 * the size of their parent boxes. */ 29 background-color: red; 30 margin: 20px; 31 height: 20px; 32 } 33 </style> 34 <div class="clamp"> 35 <div class="inner"> 36 <div class="inner">Line 1 37 Line 2 38 Line 3 39 Line 4 40 Line 5 41 Line 6</div> 42 <div class="clamped-margin"></div> 43 </div> 44 <div class="clamped-margin"></div> 45 </div> 46 <p>Following content.</p>