getComputedStyle-line-height.html (953B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Test: line-height resolved value</title> 4 <link rel="help" href="https://drafts.csswg.org/cssom/#resolved-values"> 5 <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/3749"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <style> 9 div { font-size: 16px; } 10 </style> 11 <div style="line-height: normal" data-expected="normal"></div> 12 <div style="line-height: 1" data-expected="16px"></div> 13 <div style="line-height: 10px" data-expected="10px"></div> 14 <div style="line-height: 10%" data-expected="1.6px"></div> 15 <script> 16 for (const e of document.querySelectorAll("div")) { 17 const specified = e.style.lineHeight; 18 test(function() { 19 const expected = e.getAttribute("data-expected"); 20 assert_equals(getComputedStyle(e).lineHeight, expected, specified + " should compute to " + expected); 21 }, "line-height: " + specified); 22 } 23 </script>