HTML · Unit 1: Your first web page · Lesson 1 of 5
Tags and elements
HTML describes what each part of a page is.
Opens this lesson in Code Academy.
The idea
HTML describes what each part of a page is. You mark up text with tags: an opening tag like <p> and a closing tag like </p>, which has a slash.
An opening tag, its content and its closing tag together make an element. The browser reads the element and decides how to show it: a <p> becomes a paragraph.
Tag names sit inside angle brackets < >. Write them in lowercase. That is the usual style and it is easier to read.
Worked example
HTML
<p>Hello, world!</p>
The page shows only the words. The tags tell the browser the words are a paragraph.
Key terms
- Tag
- A name in angle brackets that marks up content. <p> opens a paragraph and </p> closes it.
- Element
- An opening tag, its content and its closing tag together, such as <p>Hello</p>.
Practise it in Code Academy
It has 4 exercises (multiple choice, fill in the blank, fix the broken code and write code from a prompt) and takes about 5 minutes. Every answer is checked as you go, and feedback names the exact mistake. Hints and the solution are there if you get stuck.
Every lesson is free: no ads, no lives and no paywall.