line-clamp-with-abspos-008.html (1085B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Overflow: abspos whose containing block is the line-clamp container gets painted</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-with-abspos-005-ref.html"> 7 <meta name="assert" content="Absolute positioned boxes in a line-clamp container are shown if and only if their containing block precedes or contains the clamp point. In this case, the containing block is the line-clamp container, so the abspos gets shown, even if its static position is after the clamp point."> 8 <style> 9 .clamp { 10 line-clamp: 4; 11 font: 16px / 32px serif; 12 padding: 0 4px; 13 background-color: yellow; 14 position: relative; 15 } 16 .abspos { 17 position: absolute; 18 top: 0; 19 left: 0; 20 width: 20px; 21 height: 20px; 22 background-color: skyblue; 23 } 24 .pre { 25 white-space: pre; 26 } 27 </style> 28 <div class="clamp"> 29 <div class="pre">Line 1 30 Line 2 31 Line 3 32 Line 4</div> 33 <div class="abspos"></div> 34 <div>Line 5</div> 35 </div>