Prelims - Fonts Flashcards
fonts have a small stroke at the edges of each letter. They create a sense of formality and elegance.
Serif
fonts have clean lines (no small strokes attached). They create a modern and minimalistic look.
Sans-serif
fonts here all the letters have the same fixed width. They create a mechanical look
Monospace
fonts imitate human handwriting
Cursive
fonts are decorative/playful fonts
Fantasy
property should hold several font names as a “fallback” system, to ensure maximum compatibility between browsers/operating systems
font-family
property is mostly used to specify italic text.
font-style
The font-style property is mostly used to specify italic text.
This property has three values:
normal - The text is shown normally
italic - The text is shown in italics
oblique - The text is “leaning” (oblique is very similar to italic, but less supported)
p.normal { font-style: normal; } p.italic { font-style: italic; } p.oblique { font-style: oblique; }
property specifies the weight of a font:
font-weight
p.normal { font-weight: normal; } p.thick { font-weight: bold; }
property specifies whether or not a text should be displayed in a small-caps font
font-variant
p.normal { font-variant: normal; } p.small { font-variant: small-caps; }
property sets the size of the text.
font-size
h1 { font-size: 40px; } h2 { font-size: 30px; } p { font-size: 14px; }
The font-size value can be
absolute or relative
- Sets the text to a specified size
- Does not allow a user to change the text size in all browsers (bad for accessibility reasons)
- is useful when the physical size of the output is known
Absolute size
- Sets the size relative to surrounding elements
- Allows a user to change the text size in browsers
Relative size
To allow users to resize the text (in the browser menu), many developers use this instead of pixels
Em
1em is equal to the current font size. The default text size in browsers is 16px. So, the default size of 1em is 16px