# Absolute Length Units

> The Absolute Length CSS units, such as 'px', 'cm', 'mm', 'in', 'pt' and 'pc', represent fixed measurements that don't scale.

## What is the difference between px, pt and cm in CSS?

The units, such as 'px', 'cm', 'mm', 'in', 'pt' and 'pc', that represent fixed sizes. They don't change based on screen size or resolution, making them useful when precise control over layout is needed.

- Topic: Measurement Units
- Type: concept
- Browser support: Chrome 1+, Chrome Android 18+, Edge 12+, Firefox 1+, Firefox Android 4+, Safari 1+, Safari iOS 1+

## Example

Wrong:

```css
html {
  font-size: 16px;
}
```

Right:

```css
html {
  font-size: 100%;
}
```

'100%' keeps the user's default font size, while '16px' ignores the browser text size setting.

## Common mistakes

- Expecting '1cm' to measure one real centimeter on a screen.
- Setting `html { font-size: 16px }`, which overrides the user's chosen text size.

## Key points

- Root and body font sizes use `rem` or '%', not 'px', so text follows the user's default font size.
- Physical units like 'cm', 'mm' and 'pt' appear only in print styles, not in screen layouts.
- Borders, shadows and hairlines use 'px', where a fixed size is intended.

## Interview questions

### How many pixels is 1in in CSS?

Exactly '96px'. CSS fixes '1in' to '96px', so '1cm' is about '37.8px' and '1pt' is '1/72in'.

### Is px an absolute unit in CSS?

Yes. A CSS pixel is a fixed reference unit, but on high-density screens one CSS pixel covers several device pixels.

### When should I use pt in CSS?

Use 'pt' mostly in print style sheets, where font sizes in points match what printed documents expect.

## Related cards

- [Relative Length Units](https://wonderium.dev/css/relative-length-units.md)
- [rem()](https://wonderium.dev/css/rem.md)
- [Resolution Units](https://wonderium.dev/css/resolution-units.md)
- [font-size](https://wonderium.dev/css/font-size.md)
- [@media](https://wonderium.dev/css/media.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/absolute-length-units
- Last updated: 2026-11-25
