line-clamp-022.tentative.html (995B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Overflow: when clamping by lines, margins are respected</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 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: 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 </style> 27 <div class="clamp"><div class="inner"><div class="inner">Line 1 28 Line 2 29 Line 3 30 Line 4 31 Line 5 32 Line 6</div></div></div> 33 <p>Following content.</p>