CHAPTER 15
CSS Fonts
Learn how to control font family, size, weight, style and other typography properties.
01. What is CSS Fonts?
CSS fonts control how text appears on a webpage.
font-family defines the typeface.
font-size controls text size.
font-weight controls thickness.
font-style can make text normal, italic or oblique.
02. Syntax
selector {
font-family: family;
font-size: size;
font-weight: weight;
font-style: style;
}
03. Example
CSS / HTML Example
AIFA Coding Lab
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
font-family: Arial, sans-serif;
font-size: 40px;
font-weight: 800;
}
p {
font-family: Georgia, serif;
font-size: 18px;
font-style: italic;
}
</style>
</head>
<body>
<h1>AIFA Coding Lab</h1>
<p>
Learn CSS professionally.
</p>
</body>
</html>
04. Important Points
✓
font-family defines the font.
✓
font-size controls size.
✓
font-weight controls thickness.
✓
font-style controls italic and normal styles.
✓
Use fallback fonts when the primary font is unavailable.
05. Common Mistakes
⚠
Using fonts that are difficult to read.
⚠
Using too many different fonts on one page.
⚠
Forgetting fallback fonts.
⚠
Using extremely small font sizes on mobile.
06. Real World Use
Typography is used to create professional headings, readable paragraphs, navigation menus, landing pages and brand designs.
Ready to Practice? 🚀
Open the AIFA CSS Editor and practice this chapter live.
Try It Yourself →
Practice Exercise
Create a Typography Section
Create a heading using a bold font and a paragraph using a different font family and size.