webkit-line-clamp-008.html (1035B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Overflow: -webkit-line-clamp applied to all flex items</title> 4 <link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au"> 5 <link rel="help" href="https://drafts.csswg.org/css-overflow-3/#webkit-line-clamp"> 6 <link rel="match" href="reference/webkit-line-clamp-008-ref.html"> 7 <meta name="assert" content="When -webkit-line-clamp applies to a -webkit-box or -webkit-inline-box flex container, it becomes flow-root, there's no flexing, and clamping applies normally to the inflow children within the same FC. Lines in IFC are skipped."> 8 <style> 9 .clamp { 10 display: -webkit-box; 11 -webkit-box-orient: vertical; 12 -webkit-line-clamp: 2; 13 font: 16px / 32px serif; 14 white-space: pre; 15 padding: 0 4px; 16 background-color: yellow; 17 } 18 div { 19 overflow: hidden; /* can be removed once implementations update their old -webkit-line-clamp implementations */ 20 } 21 </style> 22 <div class="clamp"><div>Line 1 23 Line 2 24 Line 3</div><div>Line A 25 Line B 26 Line C</div>Line 一 27 Line 二 28 Line 三</div>