CSS Font Flashcards
Font-family
- specifies the font family for generic name
- always specify a generic name
- ex: sans-serif
Serif vs Sans-serif (main fonts)
- serif (little feet on the text)
- sans-serif (without feet)
- ex: font-family: sans-serif;
Font-size
- can specify font size
- ex; font-size : 28pt;
Font-variant
display font in small caps
-valid values:
normal (default)
small caps (uppercase but reduced size)
-ex: font-variant: small-caps;
Font style
-controls the slant font
-valid values:
normal
oblique
italic
Font-weight
-controls boldness of characters
-accepts numeric and pre-defined values:
100-900 (default is 400)
normal, lighter, bold (700), bolder
ex: .italic { font-weight: 800; font-style: italic: }
link href
style
- used to import fonts
- if your font doesn’t work, you have backup fonts separated by a comma
text-align
-specifies the alignment of a text
-values:
center
left
right
justify
justify-all (forces the last line to be justified unlike justify)
text-decoration
controls underlining, overlaying and strike-through
valid values: underline overline line-through none
ex: text-decoration: underline;
text-transform
controls capitalization of letters
valid values:
ppercase, lowercase, capitalize which will set the first letter of each word to uppercase, or none
line-height
-the line-height property which controls the space in between lines of text. You can set the value to a numerical or length value as well as percentage
p {
line-height: 3em;
}
text-indent
controls spacing before first line of text of an element
values;
numerical
length
percentage
p {
text-indent: 1em;
}
Vertical-align
controls the vertical alignment of text in relation to its parent element
valid values: baseline top bottom etc
direction
specifies reading direction
valid values;
ltr (left to right)
rtl (right to left)
ex: *{
direction: rtl;
}
letter-spacing
controls spacing between letters
ex: p {
letter-spacing: 1em;
}