CSS Font
Next ❯CSS List
- turned_in_notFont Properties
- font-family
- font-size
- font-style
- font-variant
- font-weight
- font
font-family
It specifies font for an element and can hold several font names as "backup font" (separated by comma). If the browser does not support the first font, it tries the next font and so on.
- So, start with the font you want &
If any font name contains white-space, it must be quoted by single or double quote - If no font found as specified then it uses the browser default font
- turned_in_not2 Types of font-family names
- labelFont Family
- Some specific font families, different look
A
ArialA
AharoniA
Chiller - labelGeneric Family
- Group of similar look font families
A
SerifA
Sans-serifA
Monospace
Syntax
font-family: 1stFontName, 2nFontName, .... , NthFontName;
/*Example*/
font-family: arial, roboto, monospace;
*You can get/use free font families from google fonts
Checkout Font !
p {
font-family: serif;
font-size: xx-large;
font-style: normal;
font-variant: normal;
font-weight: normal;
}
Fontsubject
Fontclose
<!DOCTYPE html>
<html>
<head>
<title>Full CSS Code</title>
<style>
p {
font-family: serif;
font-size: xx-large;
font-style: normal;
font-variant: normal;
font-weight: normal;
}
</style>
</head>
<body>
<p style="text-align: center;">Checkout Font !</p>
</body>
</html>
- label_outlineTryout Others
Properties Values font-family:
font-size:
font-style:
font-variant:
font-weight:
Checkout Text Font !
p {
/*font: style variant weight size family;*/
font: italic small-caps bold large arial;
}
font (All-In-One)subject
font (All-In-One)close
<!DOCTYPE html>
<html>
<head>
<title>Full CSS Code</title>
<style>
p {
/*font: style variant weight size family;*/
font:italic small-caps bold large arial;
}
</style>
</head>
<body>
<p style="text-align: center;">Checkout Text Font !</p>
</body>
</html>
- 'font' property must required 'size' and 'family' to work
❮ Prev CSS Text
Next ❯CSS List