Loading lessons...
Project 3: Style the Text Page
Project 3: Style the Text Page
Typography: fonts, sizes, alignment and shadows - style a reading page beautifully.
The CSS crew
body {
font-family: Georgia, serif;
line-height: 1.6;
font-size: 16px;
color: #333;
}
h1 {
font-weight: 800;
letter-spacing: 0.5px;
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}
.small-note {
font-size: 0.8em; /* relative to parent font size */
font-style: italic;
}
Shrink science
emscales with the parent font-size;remscales with the root.- Use
remfor page-wide sizes,emfor components you want to scale internally. line-heightbetween 1.4 and 1.7 is easiest to read.- Add
max-width: 65chto the text container for comfortable line length.
Your mission
- Pick a readable font family and a body size.
- Give headings a heavier weight and a lazy text-shadow.
- Make one note styled with
emsizing. - Keep line-lengths short - wrap the text in a container with safe max-width.
Checklist
- [ ] Body color + size + family set
- [ ] Nice
line-height - [ ] Headings styled with weight and shadow
- [ ] One element used
emorrem - [ ] Text width is comfortable
TL;DR
Readable text = font-family + size + line-height + comfortable width. em is parent-relative; rem is root-relative.