HTML · Course navigation

HTML Elements

Structure a document with semantic tags.

On this page

The concept

Elements mark up content according to meaning. Use headings in order, paragraphs for text, and links for navigation.

Code example

HTML
<main>
  <h1>Hello, world</h1>
  <p>My first page.</p>
</main>

Follow the code

Open the walkthrough to inspect the example one step at a time.

Show guided walkthrough
Guided walkthroughReady
1<main>
2 <h1>Hello, world</h1>
3 <p>My first page.</p>
4</main>

Follow the example

Start to inspect the source, values, and output. These prepared steps explain the published sample; grouped loop steps describe multiple iterations.

View the complete dry-run table
Prepared trace of the published program. Some rows group repeated iterations.
Step / lineWhat happensState after stepOutput so far
main identifies the primary content of the document.—
—
h1 supplies the page heading.—
—
p supplies a paragraph. The browser renders these elements; there is no console output.—
—

Behind the scenes

How HTML processes this code

The browser parses HTML into a document tree and renders its elements. HTML does not execute as a sequence of program statements.