Think of the last web page you opened. It had a big heading at the top, a few paragraphs, and maybe an image and some links. How does the browser (Chrome, Firefox, Safari and so on) know which part is the heading and which is a paragraph? From HTML. Every web page is written in HTML. HTML labels each part of the page: this is a heading, this is a paragraph, this is an image, this is a link. The browser reads those labels, then shows the page.
HTML is short for HyperText Markup Language. Markup means labels: you label each piece of text, and the browser shows it according to those labels. HyperText means text that can lead to other pages through links.
Tags: labels around text
The labels in HTML are called tags. Imagine you give a page of text to a print shop. Before the heading line you write a note, "heading starts", and after it, "heading ends". The print shop prints that line big and does not print your notes. In HTML, the browser is the print shop, the tags are the notes, and the text between the two notes is the content.
You write a tag between the < and > signs. Here is one heading:
<h1>Hello, World!</h1>
This line has three parts:
<h1>is the opening tag. It means "a heading starts here". Thehstands for heading. The1means the main heading.Hello, World!is the content, the text that shows on the page.</h1>is the closing tag. It means "the heading ends here". It looks like the opening tag with a slash/added.
In the browser, all you see is Hello, World! in big, bold text. If you change the tag, the same text shows differently: <p>Hello, World!</p> shows as a paragraph in normal text, because the <p> tag marks a paragraph.
The opening tag, the content and the closing tag together are called an element: one complete part of the page. So <h1>Hello, World!</h1> is one element (one heading), and one paragraph is another element.
The first exercise has this same code, <h1>Hello, World!</h1>. It's already correct there, so don't change it. Just press Run Test to see the result.
The skeleton of an HTML page
That <h1> element is just one small piece of a page. A whole HTML page has a skeleton like this:
<!DOCTYPE html>
<html lang="en">
<head>
<title>My First Website</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is my first website.</p>
</body>
</html>
Read it from the top:
<!DOCTYPE html>always goes on the very first line. It tells the browser "this is modern HTML, use standards mode". Standards mode means the browser shows the page by today's rules. This line isn't an element, so it has no closing tag.<html>is the outermost tag. It wraps everything else, and</html>closes it on the very last line. The extralang="en"in its opening tag means the page is in English.- Inside
<html>there are two parts:<head>and<body>.
A tag that sits inside another tag is written further to the right (indented), so you can see which tag wraps which. The indent doesn't change how the page looks.
This skeleton is the shortest version. A real page usually has two more lines in <head>: <meta charset="UTF-8">, so symbols like © show correctly, and a <meta> tag named viewport, so the page fits a phone screen. Both are covered in the Meta Tags lesson.
<head> for the browser, <body> for visitors
Of <head> and <body>, only one shows on the page:
<body>holds everything visitors see: headings, paragraphs, images, links. In the skeleton above it holds an<h1>and a<p>.<head>holds information about the page. Nothing in it shows on the page. One example is<title>: its text appears in the browser tab, as the page's name.
So the page from that skeleton looks like this. The browser tab says My First Website. On the page there is the heading Hello, World! in big, bold text. Below it is the sentence This is my first website. in normal text.
HTML, CSS and JavaScript
A web page is built with three languages. Each one has its own job:
- HTML builds the content and says what each part is: this is a heading, this is a paragraph, this is a list.
- CSS sets how it looks: colours, font sizes, positions.
- JavaScript lets the page react, for example a menu that opens when you click it.
Because the content is in the HTML, you can still read a page without CSS. It just looks plain, with the browser's default fonts and colours. If a web page were a house, HTML would be its frame, and CSS would be its paint and decoration.
⚠️ Small mistakes on a first page
- A missing closing tag. If
</h1>is missing, the browser doesn't know where the heading ends. The text below it also shows big, like a heading. - Page content written in
<head>.<head>is not the place for page content. Headings and paragraphs go in<body>. - A missing
<!DOCTYPE html>. The browser switches from standards mode to an old mode that copies very old browsers. It is called quirks mode. The page can look slightly different. - Tags in capital letters.
<H1>still works, but the usual habit is all lowercase:<h1>.
TL;DR: HTML (HyperText Markup Language) is a markup (labelling) language for building a web page's content. Its labels are called tags: <h1> marks a heading, <p> marks a paragraph. An opening tag, the content and a closing tag make one element (one complete part of the page), like <h1>Hello, World!</h1>. The page skeleton: <!DOCTYPE html> on the very first line, then <html> wrapping everything. Inside it, <head> holds information that doesn't show (like <title>), and <body> holds everything that does. HTML builds the content, CSS sets the look.
⚡ One heading, three parts
Write:
<h1>Hello, World!</h1>
Guess first: what shows in the browser?
Only the words Hello, World!, big and bold. <h1> and </h1> don't show.
Meaning: <h1> opens the heading and </h1> closes it (note the slash /). These two labels are called tags. A tag tells the browser what kind of text it holds: <h1> for a heading, <p> for a paragraph. The opening tag, the content and the closing tag together make one element: one complete part of the page.
The first exercise already has this code, and it's correct. Just press Run Test.
⚡ The skeleton of a page
Write:
<!DOCTYPE html>
<html lang="en">
<head>
<title>My First Website</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is my first website.</p>
</body>
</html>
Guess first: where do the words My First Website show up?
In the browser tab, not on the page. <title> is inside <head>, and nothing inside <head> shows on the page.
Meaning: <!DOCTYPE html> always goes on the first line, then <html> wraps everything. What visitors see goes in <body>. Information for the browser, like <title>, goes in <head>.
⚡ HTML builds, CSS decorates
Guess first: can a page without CSS (the language that sets the look) still be read?
Yes. The content is all there. It just looks plain, with the browser's default fonts and colours.
Meaning: HTML builds the content and says what each part is: this is a heading, this is a paragraph. CSS sets the look: colours, font sizes, positions. JavaScript lets the page react, for example a menu that opens when you click it.