<htmlstart/>

CSS Typography

Control fonts, sizes, weight, spacing, and text alignment.

Font Properties

body {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;        /* base size */
  font-weight: 400;       /* 100–900, or normal/bold */
  font-style: italic;     /* normal | italic */
  line-height: 1.6;       /* 1.5–1.8 for body text */
}

Google Fonts

<!-- In <head> -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">

<!-- In CSS -->
body { font-family: "Inter", sans-serif; }

Text Properties

p {
  color: #333;
  text-align: center;        /* left | center | right | justify */
  text-decoration: underline; /* none | underline | line-through */
  text-transform: uppercase;  /* none | uppercase | lowercase | capitalize */
  letter-spacing: 0.05em;
  word-spacing: 4px;
}

h1 {
  font-size: clamp(24px, 4vw, 48px); /* responsive font size */
}
Set font-size: 16px on body and use rem units for everything else — 1rem = 16px and scales with user browser settings.
🧩

Test Yourself

4 questions
Q1.Which CSS property sets the typeface?
Q2.What line-height is recommended for readable body text?
Q3.Which property controls the spacing between individual letters?
Q4.Which CSS declaration makes text display in ALL CAPS?