Summary
In this lesson, we learned that:
- The
strongandemelements give text a meaning; how text looks is set by CSS. font-familysets the font. Its value is a list of fallbacks: the browser uses the first font from the list that it has. We end the list with a generic family,serif,sans-seriformonospace, never in quotes. Font names with spaces are written in quotes:"Times New Roman".- The font and the other properties of text are inherited, so we set the main font on
body. font-weightsets how bold the text is, from100to900;normalis400andboldis700. A font only looks different in the weights it has.font-style: italicmakes text italic, andfont-style: normalmakes it upright again.font-sizesets the size of the text. Besides pixels, we userem: 1rem is the browser's base font size, usually 16 pixels, and sizes in rem respect the visitor's settings.line-heightsets the height of a line. A number without a unit, such as1.6, is a multiple of the font size and grows with it.text-alignaligns text:left,right,centerorjustify.text-transformchanges the case of the letters (uppercase,lowercase,capitalize), andletter-spacingthe space between them.- Web fonts are downloaded with the page, for example from Google Fonts, using
linkelements in thehead. We keep fallbacks in the list in case the font can't be downloaded.
In the next lesson, CSS Box Model, we will find out how much space elements take up and how to add space inside and around them.
Instructions
- 1
Congratulations on completing the lesson! The editor contains your page as it looks now. Try other fonts from Google Fonts, other sizes or alignments.