unit

cap — CSS reference

One cap corresponds to the capital-letter height metric of the first available font. When the metric cannot be determined, font ascent is used. This can align a decorative icon with uppercase lettering without assuming a particular font. Font-relative lengths can resolve differently in font-size or line-height itself to avoid self-dependence; consult the property-specific rules.

Formal Syntax & Structure

css syntaxcss
width: 4cap;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>Relative length lab</title><style>body {margin:0} .sample {height:12px;background:#006050}html {font:20px/28px monospace} #a {font:20px/28px monospace;width:4cap} #b {font:40px/56px monospace;width:4cap}</style><body><div id="a" class="sample"></div><div id="b" class="sample"></div></body></html>
CSS Reference