A rem is a CSS length relative to the font size of the root element, usually `<html>`. Unlike an em, which uses the parent element’s font size as its base, a rem uses the root’s size. If no root font size is set, most browsers default to 16px. section 4.1.1
Size a newspaper headline
Set `h1 { font-size: 4rem; }` to make the headline four times the root font size. With a 16px root size, it renders at 64px. section 4.1.1
Listing 6.11 Styling the name
h1 { #1
font-size: 2rem; #1
margin: 36px 0 0; #1
color: var(--primary); #1
} #1
.title { #2
font-size: 1.25rem; #2
font-weight: bold; #2
color: var(--secondary); #2
} #2
The profile card uses `2rem` for the name and `1.25rem` for the job title. At a 16px root size, the name is 32px. Relative font sizes help text scale with user settings or device needs. section 6.7.1
Rems also work beyond headings. A form input set to `font-size: 1rem` matches the application’s text size; the input needs explicit font styling because it does not inherit those styles by default. The same rule uses `.25rem` for padding but `1px` for its border. section 10.3.1





