CKTIS / CSS
ric — the root ideographic unit
The ric unit equals ic on the document’s root element. It sizes lengths using the root’s ideographic metrics rather than a descendant’s font size.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
<number>ricric is a length unit equal to ic on the root element, usually html. The value 10ric means ten times that measure.
ic uses the used advance measure of the 水 (U+6C34) glyph in the font rendering that character, not its visible outline width. If determining the measure is impossible or impractical, it defaults to 1em.
Unlike local ic, ric references the root; rem instead references its font size. To avoid circularity, ric uses font metrics derived from initial values when it is used to compute the root element’s font-size. The font shorthand sets font-size and line-height as separate longhands. The font-size exception does not apply to line-height: in the root element’s line-height, ric uses the root’s computed font metrics, even when line-height is set through font. It also uses metrics derived from initial values outside an element context, such as in media queries.
The example compares two bars. Their widths should match despite different local font sizes. The exact pixel width depends on fonts; check unit support in the target browser.
Examples
<!doctype html>
<meta charset="utf-8">
<title>ric</title>
<style>
:root { font-size: 20px; }
.bar {
width: 10ric;
height: 20px;
margin-block: 8px;
background: teal;
}
.small { font-size: 12px; }
.large { font-size: 40px; }
</style>
<div class="bar small"></div>
<div class="bar large"></div>Result
Two teal bars with equal widths and heights of 20 CSS pixels; their numeric width depends on the root font metrics.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.