Text and headings

Write the words of a page and mark which are headings.

Your HTML is drawn by your own browser, inside this tab. Nothing to install.

Tags and elements

A web page is text with labels on it. The labels are called tags, and they tell the browser what each piece of text is.

Most tags come in pairs. <p> opens a paragraph and </p> closes it. The opening tag, the text and the closing tag together are an element.

Load the example and press Run. The result is the page your browser drew from it.

Example
<p>Hello from my first page.</p>

Headings

<h1> is the main heading of a page. A page should have one.

<h2> is a heading for a section under it, and <h3> for a part of that section. They go down to <h6>.

Pick the heading by its place in the outline, not by how big it looks. Size is changed later, with CSS.

Example
<h1>Asha's Bakery</h1>
<h2>Opening hours</h2>
<p>7 am to 2 pm, every day.</p>

Your turn: a heading and a paragraph

Start a page for a library.

Practice task

Write a main heading that says City Library, followed by one paragraph that says Open every day.

Your answer is run and checked in the lesson. Try it now.

Marking important words

<strong> marks words as important. Browsers show them in bold.

<em> marks words that should be stressed when read. Browsers show them in italics.

These go inside a paragraph, around just the words they apply to. Elements can sit inside other elements, as long as the inner one closes first.

Example
<p>Return books <strong>within two weeks</strong>. Late fees are <em>not</em> charged on holidays.</p>

Your turn: an important word

Put one element inside another.

Practice task

Write a paragraph that says Silence please, with only the word Silence marked as important.

Your answer is run and checked in the lesson. Try it now.