letter-spacing-trim-start-002.html (953B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <link rel=author href="mailto:jkew@mozilla.com"> 6 <link rel=help href="https://drafts.csswg.org/css-text-3/#letter-spacing-property"> 7 <link rel=help href="https://bugzilla.mozilla.org/show_bug.cgi?id=1892262"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <style> 11 #t, #r { 12 font: 20px/1 monospace; 13 letter-spacing: 2ch; 14 overflow-wrap: anywhere; 15 outline: 1px solid black; 16 margin: 10px; 17 } 18 </style> 19 <script> 20 function run() { 21 let refWidth = r.offsetWidth; 22 23 test(() => assert_less_than(t.offsetWidth, refWidth, "test div should have smaller width")); 24 25 t.style.width = "max-content"; 26 27 test(() => assert_equals(t.offsetWidth, refWidth, "widths should now match")); 28 } 29 </script> 30 </head> 31 <body onload="run()"> 32 <div id="r" style="width: max-content;"> 33 aaaaa<i></i>bbb 34 </div> 35 <div id="t" style="width: 15ch;"> 36 aaaaa<i></i>bbb 37 </div>