← Web design from scratch

What is HTML?

It is time to start writing code. In this lesson, you will learn what HTML is, how its tags work and how to create your first web document.

Level · Beginner Time · 20–25 min Path · Web design

01

What does HTML mean?

HTML stands for HyperText Markup Language.

It is the language we use to define the structure and content of a web page.

With HTML, we can tell the browser which element is a heading, which is a paragraph, where an image should appear and which text should become a link.

Important: HTML mainly defines structure. Later, we will use CSS to control how that structure looks.

02

HTML uses tags.

Most HTML elements are written using an opening tag and a closing tag.

For example, a paragraph:

<p>This is my first paragraph.</p>

The first tag opens the element:

<p>

And the second closes it:

</p>

Between them, we write the content we want to display on the page.

03

Some basic tags.

You do not need to memorise hundreds of tags. We will start with a few that you will use regularly.

01

<h1>

Defines the main heading of a page.

02

<p>

Defines a paragraph of text.

03

<a>

Creates a link.

04

The basic structure of an HTML document.

An HTML page begins with a basic structure that we will use almost every time.

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>My first website</title>
</head>

<body>

  <h1>My first web page</h1>
  <p>I am learning HTML.</p>

</body>

</html>

It may seem like a lot at first, but we will go through each part.

05

HTML, HEAD and BODY.

01

<html> contains the entire HTML document.

02

<head> contains information about the page that does not normally appear directly in its content.

03

<body> contains everything visitors see: headings, text, images, buttons and other content.

06

Headings have a hierarchy.

HTML has six heading levels:

<h1>Main heading</h1>
<h2>Section heading</h2>
<h3>Subheading</h3>
<h4>Level 4</h4>
<h5>Level 5</h5>
<h6>Level 6</h6>

Do not choose headings simply because of their visual size. They represent the organisation and hierarchy of the content.

We will normally use an h1 for the main heading of each page and h2 for its major sections.

07

How to create a link.

Links connect pages to one another.

We use the tag:

<a>

For example:

<a href="contact.html">Contact</a>

The href attribute tells the browser which page the link should open.

08

Create your first HTML file.

Now let's create something real.

Create a folder on your computer called:

my-first-website

Inside it, create a file named:

index.html

The name index.html is important because it is commonly used for a website's homepage.

09

Write your first page.

Inside index.html, write:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>My first website</title>
</head>

<body>

  <h1>Welcome to my website</h1>

  <p>
    This is my first page created with HTML.
  </p>

</body>

</html>

Save the file and open it in your browser.

If everything is correct, you will see your heading and first paragraph.

What you have learned.

  • HTML defines the structure of a web page.
  • HTML uses tags.
  • Many tags have opening and closing forms.
  • HEAD contains information about the page.
  • BODY contains the visible content.
  • Headings organise content.
  • Links are created using the <a> tag.
  • The homepage is usually named index.html.

Build your first HTML page.

Use your index.html file and add:

  1. A main heading using h1.
  2. A subheading using h2.
  3. Two paragraphs.
  4. One link.

Then save the file and reopen it in your browser to check the changes.

Do not worry about the design. For now, the page will be very simple. In the next lesson, you will learn how CSS transforms its appearance.

PREVIOUS LESSON

← 02 · What you need before creating your website