BETAThis is a new service – your feedback will help us to improve it.

Introducing HTML

We use HTML to add structure to our content.

Because all web browsers understand and interpret HTML in the same way, we can use it to tell a web browser what purpose each part of the content in our webpage serves, for the benefit of human users.

Tags

You write HTML by adding special tags to your content.

Here is some HTML content, surrounded by tags:

<p>Use the force, Luke</p>

This is a paragraph tag. By writing this, we're telling the web browser that "Use the force, Luke" is a bit of normal paragraph text.

You'll see that there is a tag either side of the content. These are the opening tag and closing tag. Notice that the closing tag has an extra forward slash inside it.

Here's another tag:

<h1>Surf the net</h1>

This is a level 1 heading tag. Just like if we were writing a Word document, a top-level heading is usually going to be the title of our webpage.

We could also use <h2></h2> or any other heading tag through to <h5></h5>. All these different levels of heading let us add structure to our content.

Self-closing tags

A small number of HTML tags don't need a separate opening and closing tag. These are called self-closing tags.

Take a look at this tag:

<hr/>

This is a horizontal rule tag. It's often used to define section breaks in your content. It doesn't need any content inside it, so there is no separate opening and closing tag.

Instead, there is a forward slash before the second angled bracket.

Most webpages contain a mixture of normal and self-closing tags. The best way to remember which tags are which is practice.

HTML adds...

Lessons last updated 12th July 2019. You can improve this lesson on Github.
Part of Building webpages
  1. Your first webpage
  2. Introducing HTML
  3. HTML attributes
  4. Classes and IDs
  5. Introducing CSS
  6. CSS selectors
  7. CSS specificity
  8. Creating layouts
  9. Responsive design
  10. Get confident with HTML and CSS
  11. Turn your prototypes into webpagesP