</> Code Corner

CSS · CSS Tutorial · Lesson 15

CSS Fonts

Font families, sizes, weights and Google Fonts.

Choosing the right font has a huge impact on how readers experience a website.

Generic Font Families

  • serif — small strokes at the edges (Times New Roman)
  • sans-serif — clean lines (Arial, Verdana)
  • monospace — equal-width letters (Courier New)
  • cursive and fantasy

Example

<style>
.p1 { font-family: "Times New Roman", Times, serif; }
.p2 { font-family: Arial, Helvetica, sans-serif; font-size: 20px; font-weight: bold; }
.p3 { font-family: "Courier New", monospace; font-style: italic; }
.p4 { font: italic small-caps bold 18px/1.5 Georgia, serif; }
</style>
<p class="p1">Serif font</p>
<p class="p2">Bold sans-serif 20px</p>
<p class="p3">Italic monospace</p>
<p class="p4">Font shorthand</p>

Keep reading “CSS Fonts”

Sign up to read the full lesson (1 more parts), try every example in the live editor, and take the 5-question quiz.

Chat with us 👋