Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-values/update-subpixel-rem-unit.html - WPT Dashboard Interop Dashboard
<!doctype html>
<html style="font-size:16px">
<head>
<title>CSS Values and Units Test: rem subpixel change</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div style="font-size:16px">
<div id="remElement" style="width: 10rem"></div>
</div>
<script>
test(() => {
assert_equals(getComputedStyle(remElement).width, "160px");
// Using a fractional-pixel value that can be exactly represented in terms
// of units of either 1/64 or 1/60 pixel, to avoid rounding issues for
// engines that use either of these as an "app unit" internally.
document.documentElement.style.fontSize = "16.25px";
assert_equals(getComputedStyle(remElement).width, "162.5px");
}, "Check that a 0.25px change in root font-size affect rem units.");
</script>
<body>
</html>