In CSS, you can specify the font family, size, style, weight, and other properties for the text on your web page. Here are some of the most commonly used properties:
font-family
: This property sets the font family used for the text. It can be a specific font or a generic font family, such asserif
,sans-serif
,monospace
,cursive
, orfantasy
.
body {
font-family: Arial, sans-serif;
}
font-size
: This property sets the size of the text.
p {
font-size: 16px;
}
font-style
: This property sets the style of the text, such asnormal
,italic
, oroblique
.
em {
font-style: italic;
}
font-weight
: This property sets the weight of the text, such asnormal
,bold
, or a specific numeric value.
strong {
font-weight: bold;
}
font-variant
: This property sets the variant of the text, such asnormal
orsmall-caps
.
small {
font-variant: small-caps;
}
font-stretch
: This property sets the stretch of the text, such asnormal
,condensed
, orexpanded
.
h1 {
font-stretch: condensed;
}
line-height
: This property sets the height of the lines of text.
p {
line-height: 1.5;
}
By combining these properties, you can create a wide variety of font styles for your web page. It’s important to choose font families that are commonly available on most computers and devices to ensure that your text displays consistently for all users.