Headings big, small print small — rhythm in text size is a big part of what makes a page easy to read. The property that controls it is font-size. Learning just this one thing tightens up the whole feel of your page.
Let’s write it
h1 {
font-size: 32px;
}
p {
font-size: 16px;
}This means “make headings 32 pixels and paragraphs 16 pixels.” The bigger the number, the bigger the text. px (pixels) is the most basic unit — it expresses size by the number of dots on the screen.
- Want a heading to stand out → make the number bigger
- Want side notes to stay quiet → make the number smaller
Change the number, and the text size changes right along with it.
What you learned in HTML pays off here
“Choose a heading by its meaning, not its size” — here’s where that reason connects. If you first give <h1> through <h6> the right meaning in HTML, then later you can adjust the whole look at once with CSS: “h1 big, h2 moderate.”
This is how the reward for splitting up the roles comes back to you later. Build the framework (HTML) with care, and dressing it up (CSS) becomes much easier.
HTMLLet's write headings and paragraphs“Choose a heading by its meaning” — the groundwork you laid back then connects hereEven without setting it, the sizes differ from the start
Without you setting anything in CSS, <h1> through <h6> are already slightly different sizes by the browser’s default (h1 is the biggest, and each higher number is smaller). font-size is the setting that overrides those defaults to your own taste. Even if you forget to set it, at least the big-to-small relationship follows the meaning — that’s a little reassuring, isn’t it?
Summary of this lesson
- Text size is
font-size - Add a unit (like
px) to the number - Give meaning in HTML → adjust size in CSS — that flow feels good
h1throughh6start out at different sizes.font-sizeis the override of those defaults
