01 / 05
font-size decides the size
Put a page together
INPUT · Slides
01 / 05
The size of text is set with the font-size property. The unit people reach for is px (pixels).
px is a count of dots on the screen. A bigger number is bigger text.
p { font-size: 20px;}02 / 05
Write 20 px with a space in between and it does nothing. It has to be 20px, joined up.
font-size: 20; with no unit does nothing either, because a bare number does not settle a size.
h2 { font-size: 28px;}03 / 05
<h1> comes out big from the start, but that is only the size the browser picked. Say so in CSS and you overwrite it.
You can even make it smaller. The division shows up again here: the tag carries the meaning, the CSS settles the size.
h1 { font-size: 24px;}04 / 05
The shape of the letters is changed with font-family. Start with the three big families.
sans-serif … strokes of even weightserif … little finishing strokes on the endsmonospace … every character the same widthp { font-family: serif;}05 / 05
Size, typeface, colour — all of it changes inside style.css alone. index.html is not touched at all.
You can change how it looks without rebuilding what is there. That is the most welcome thing about CSS. Let us try it.
h1 { font-size: 36px; font-family: serif; color: #6d4c41;}