staticdata.dev
Menu
Datasets About Contact

CSS Units

62 CSS units covering all specification categories: absolute lengths (px, cm, in, pt, pc, mm, Q), relative lengths (em, rem, vw, vh, and the full set of viewport, container-query, and font-relative units), angles (deg, rad, turn, grad), time (s, ms), frequency (Hz, kHz), resolution (dpi, dpcm, dppx, x), and the grid flex unit fr.

v1.0.0 MIT 62 records Updated 2026-10-05 stable Source:  CSS Values and Units Module Level 4 — W3C, MDN Web Docs — CSS values and units

Quick fetch

Stable URL. CORS-enabled. No auth.

bash
curl https://staticdata.dev/v1/css-units.json

Or use as a typed import: import { cssUnits } from "https://staticdata.dev/v1/css-units.ts"

Formats

  • JSON 8.0 KB

    /v1/css-units.json

    Open

    min: 6.6 KB · /v1/css-units.min.json

  • CSV 4.2 KB

    /v1/css-units.csv

    Open
  • TypeScript 8.2 KB

    /v1/css-units.ts

    export const cssUnits

    type CssUnit = (typeof cssUnits)[number]

    Open

Schema

Each record in the dataset has the following shape.

Schema
Field Type Description Example
unit string The CSS unit token (e.g. px, em, deg) px
category string Unit category: length-absolute, length-relative, angle, time, frequency, resolution, or flex length-absolute
description string Human-readable explanation of the unit and its relationship to other units Pixels. 1px = 1/96 of 1in. The reference pixel unit for CSS.

Preview

First 10 records.

Data preview
unitcategorydescription
cmlength-absoluteCentimeters. 1cm = 96px/2.54 ≈ 37.8px.
mmlength-absoluteMillimeters. 1mm = 1/10 of 1cm.
Qlength-absoluteQuarter-millimeters. 1Q = 1/4 of 1mm. Primarily used in Japanese print layouts.
inlength-absoluteInches. 1in = 2.54cm = 96px.
pclength-absolutePicas. 1pc = 12pt = 1/6 of 1in.
ptlength-absolutePoints. 1pt = 1/72 of 1in ≈ 1.333px.
pxlength-absolutePixels. 1px = 1/96 of 1in. The reference pixel unit for CSS.
caplength-relativeCap height of the element's font — the height of a capital letter.
chlength-relativeWidth of the '0' (zero) glyph in the element's font.
emlength-relativeRelative to the font-size of the element itself. 1em = current font-size.

Showing 10 of 62. View full data:  JSON · CSV

Fetch examples

Drop-in snippets in five languages.

curl
curl -sSL https://staticdata.dev/v1/css-units.json | jq '.[0]'
JavaScript
import type { CssUnit } from "https://staticdata.dev/v1/css-units.ts";

const res = await fetch("https://staticdata.dev/v1/css-units.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const cssUnits: CssUnit[] = await res.json();
console.log(cssUnits[0]);
Python
import urllib.request, json

with urllib.request.urlopen("https://staticdata.dev/v1/css-units.min.json") as r:
    cssUnits = json.load(r)

print(cssUnits[0])
Go
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
)

func main() {
	resp, err := http.Get("https://staticdata.dev/v1/css-units.min.json")
	if err != nil { panic(err) }
	defer resp.Body.Close()

	var data []map[string]any
	if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
		panic(err)
	}
	fmt.Println(data[0])
}
Rust
use serde_json::Value;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let body = ureq::get("https://staticdata.dev/v1/css-units.min.json").call()?.into_string()?;
    let data: Vec<Value> = serde_json::from_str(&body)?;
    println!("{:?}", data.first());
    Ok(())
}

Sources and methodology

This dataset was curated from the CSS Values and Units Module Level 4 W3C specification and corroborated against MDN Web Docs. It includes the 62 unit tokens defined in CSS Values and Units Level 4, CSS Containment Level 3 (container-query units) and CSS Grid (fr), as of October 2026, across seven categories, from the classic px and em through modern viewport units (svh, dvw, lvmin) and container-query units (cqw, cqi, cqb).

The category field uses one of seven values: length-absolute for physical/fixed-size units (px, cm, in, mm, pt, pc, Q); length-relative for units derived from font metrics, viewport dimensions, or container size; angle for rotation and hue values; time for animation and transition durations; frequency for the aural CSS speech units; resolution for media query resolution detection; and flex for the CSS Grid fractional unit fr. Records are grouped by category (not sorted alphabetically).

Frequency units (Hz, kHz) are part of the CSS spec but currently only apply to the largely unimplemented aural/speech stylesheet feature. The Q (quarter-millimeter) unit has limited browser tooling adoption but is part of the CSS spec and is used in Japanese print workflows. Most other units have broad browser support; some newer ones (such as the root-font units rcap, rex, ric and rch) arrived later, so check current browser support data before relying on them.

Versioning

URLs under /v1/ are stable: field names and types will not change in a way that breaks consumers. Values can be corrected or records added when the upstream source changes; schema-incompatible updates ship under a new version path. See the css-units changelog for this dataset's history.

Related datasets

More Code datasets