CSS Font Properties
CSS font properties control typography, including font family, size, weight, style, and web fonts.
Font Family and Size
The font-family property specifies the typeface.
List multiple fonts as fallbacks: font-family: Arial, Helvetica, sans-serif;
The font-size property sets text size using px, em, rem, %, or keywords.
Generic font families: serif, sans-serif, monospace, cursive, fantasy.
/* Font families */
body {
font-family: Arial, Helvetica, sans-serif;
}
h1 {
font-family: Georgia, 'Times New Roman', serif;
}
code {
font-family: 'Courier New', monospace;
}
/* Font sizes */
.small {
font-size: 14px;
}
.medium {
font-size: 1rem;
}
.large {
font-size: 1.5em;
}