Code Bytes · "Web Fundamentals" · Episode 3 · HTML
What HTML is
HTML stands for HyperText Markup Language. It's the skeleton of every web page. Its labels, called tags, are written in angle brackets and tell the browser what each piece of a page is, such as a heading or a paragraph. HTML gives a page its structure, not its looks.
HyperText Markup Language
HTML stands for HyperText Markup Language. Markup means labels: you label each piece of a page so the browser knows what it is. "This is a heading." "This is a paragraph."
(Hypertext means text with links to other pages, which is what makes the web a web.)
Structure, not looks
HTML isn't about looks. It's about structure, like a skeleton holding a body together. It says what is on the page and in what order.
The looks (colours, fonts, spacing) come from CSS, and the behaviour (what happens when you tap or type) comes from JavaScript. Both come later in this course.
HTML is a markup language, not a programming language: it labels content, it doesn't give the computer step-by-step instructions.
Tags in angle brackets
The labels are called tags, and they're written in angle brackets. Most come in pairs:
- an opening tag, like
<h1> - the content, like
My Cat - a closing tag, the same name with a slash before it, like
</h1>
``html <h1>My Cat</h1> <p>She sleeps all day.</p> ``
h1 is a heading and p is a paragraph.
What the browser shows
HTML isn't "run" like a program. A browser reads it and draws the page. For the two lines above, it shows My Cat as a big, bold heading, and She sleeps all day. under it as normal paragraph text.
There are six heading levels, h1 to h6. h1 is the biggest and most important heading; h2 is the next level down and shown smaller.
``html <h1>My Cat</h1> <h2>Her favourite spots</h2> ``
Try it yourself
- Open a plain text editor (Notepad on Windows, TextEdit in plain-text mode on a Mac) and type:
``html <h1>My Room</h1> <p>It has a bed and a window.</p> ``
- Save it as
room.htmland open it in your browser (double-click it, or drag it into a browser window). - Now change
<p>and</p>to<h1>and</h1>, save, and refresh. The sentence turns into a big heading: same words, different label.
Good to know
- The snippets here are fragments. A full page also has a
<!DOCTYPE html>line andhtml,headandbodytags around them. Browsers show fragments like these anyway. - "Big heading" and "normal paragraph" are the browser's default styles. CSS can change how any of them look; the tags still say what each piece is.
- An opening tag, its content and its closing tag together have a name of their own. That's the next lesson: Tags and elements.
- Tag names aren't case sensitive (
<H1>works too), but lowercase is the normal way to write them. - The skeleton comparison is ours, not an official definition.
Answer to the comment question
How many headings will this page show?
``html <h1>Pets</h1> <h2>Cats</h2> <p>Cats nap.</p> <h2>Dogs</h2> <p>Dogs run.</p> ``
3. "Pets" is an h1 heading, and "Cats" and "Dogs" are h2 headings. The two p lines, "Cats nap." and "Dogs run.", are paragraphs, not headings.
Test your knowledge
Quick quiz: What HTML is
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- MDN Web Docs, "HTML: HyperText Markup Language": HTML is the markup language that defines the structure and meaning of web content, while CSS handles looks and JavaScript handles behaviour
- MDN Web Docs, "Basic HTML syntax": tags in angle brackets, opening and closing tags, and the slash in a closing tag
- MDN Web Docs, "The HTML Section Heading elements": h1 to h6 are six levels of headings, with h1 the highest level
- MDN Web Docs, "The Paragraph element": the p element is a paragraph
Video transcript
What is HTML? It's the skeleton of every web page.
HTML stands for HyperText Markup Language. Markup means labels that tell the browser what each piece of a page is.
It isn't about looks. It's about structure, like a skeleton holding a body together.
Labels are called tags, in angle brackets. We type an opening H one tag, the words My Cat, then a closing H one tag with a slash.
Next line: a P tag, the words She sleeps all day, and a closing P tag.
The browser shows My Cat as a big heading, and the sentence as a normal paragraph.
H one means the biggest heading, H two a smaller one.
How many headings will this page show? Comment your answer below!
That's your byte.