Sonzaschool
Back

O-Level · Form 2 · Vocational · Electronics and Computer

Computer Programming

Implementing typography in CSS

about 3 minutes to read

Discussions
Topics in this sectionFormatting web pages with Cascading Style Sheets (CSS)5 topics

Implementing Typography in CSS

Typography in CSS refers to the properties that control how text appears on a web page. By using these properties, you can change the font, size, spacing, and thickness of text to make your web pages more readable and attractive.

1. font-family

The font-family property specifies which font to use for text. You can list multiple fonts as a fallback — if the first font is not available, the browser tries the next one.

p {
    font-family: "Arial", "Helvetica", sans-serif;
}

Common choices include serif, sans-serif, and monospace as generic family names.

2. font-size

The font-size property controls the size of the text. You can set it using pixels (px), percentages (%), or em units (em).

h1 {
    font-size: 24px;
}

3. line-height

The line-height property sets the space between lines of text. This makes paragraphs easier to read.

p {
    line-height: 1.5;
}

A value of 1.5 means the line spacing is 1.5 times the font size.

4. font-weight

The font-weight property controls how thick or thin the text appears. Common values are normal, bold, and numeric values like 400 or 700.

h2 {
    font-weight: bold;
}

How you'll be assessedProcess assessment · Outcome assessment · Knowledge assessment

Process assessment

  • Set font family using font-family.
  • Adjust font size using font-size.
  • Control line spacing using line-height.
  • Use fontweight for emphasis.
  • Preview and adjust the typography.

Outcome assessment

Topography in CSS is correctly implemented according to design requirements.

Knowledge assessment

Detailed knowledge of:

Method used: The student should explain how to:

  • implement typography in CSS.

Principles: The student should explain the principle of:

  • font-family stacks and fallback fonts.

Theories: The student should explain:

  • CSS typography properties.

Circumstantial knowledge:

Detailed knowledge about:

  • responsive typography.

Question

What does the font-family property do in CSS?

Sign in to submit your answer and have it count toward your mastery.

Sign in to practice

Tutor

Stuck? Ask me anything about this topic.

Sign in to ask the Sonza AI Tutor about this question.

Sign in to ask

Discussions

No questions yet

Sign in to ask
Loading discussions…