HTML & CSS Course
HTML & CSS
/
Beginner

Headings

Definition

HTML elements `<h1>` through `<h6>` used to define the headings of a page, representing a hierarchy of importance.

Explain Like I'm New

Headings are the titles and subtitles of your webpage, exactly like an outline for an essay. `<h1>` is the main title of the page (you should only have one!). `<h2>` are the major sections, and `<h3>` are subsections within those.

Real World Example

A news article. The headline is `<h1>`. The main sections of the article are `<h2>`. If a section has bullet points with titles, those are `<h3>`.

Common Use Cases

  • •Structuring document hierarchy
  • •SEO (Google reads headings to understand the page)

Interactive Example

Interview Questions

basic

  • Which heading tag is the largest and most important?

intermediate

  • Why shouldn't you use an `<h2>` just to make text bold and big?

Flash Cards

Question

Largest heading?

Click to reveal answer
Answer

`<h1>`

Question

Why not use it just for styling?

Click to reveal answer
Answer

Headings are for STRUCTURE, not style. Blind users use screen readers to jump from heading to heading to navigate the page. If you use an `<h2>` randomly in a paragraph just because it looks big, you destroy the structural map of the page. Use CSS (`font-size`, `font-weight`) to make text big.