×

css · level 1 · unit 5 · lesson 1

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

px, and % are three ways to measure.

px is a fixed size. rem means times the page's base text size, which is 16px unless someone changes it. So 1rem is 16px and 2rem is 32px.

% is a , a share out of a hundred. For font-size it is a share of the parent's size. 50% is half as big and 200% is twice as big.

Many people use rem for text. If a reader turns up the text size in their browser settings, everything measured in rem grows with it.

<h1>Recipe</h1>
<p>Mix the flour and the eggs.</p>
h1 {
  font-size: 2.5rem;
}
p {
  font-size: 1.25rem;
}

Press show my page to see it here.

2.5rem is two and a half times 16px, which makes 40px.