Your first web page
Every website you've ever visited is built on HTML (HyperText Markup Language). HTML describes the structure and meaning of content: "this is a heading", "this is a paragraph", "this is a link". Browsers read HTML and turn it into the page you see.
HTML isn't a programming language. It doesn't calculate or make decisions. It's a markup language: you wrap content in tags to label what it is.
The web's three languages
| Language | Job | Analogy |
|---|---|---|
| HTML | Structure and content | The skeleton |
| CSS | Presentation and layout | The skin and clothes |
| JavaScript | Behaviour and interactivity | The muscles |
Elements and tags
The editor above is live. Change the text and the preview updates as you type.
An element usually has:
- an opening tag:
<p> - content:
This is my very first web page. - a closing tag:
</p>(notice the/)
Elements can be nested inside each other, like <strong> inside <p>. Close them in the reverse order you opened them.
The full document structure
A real HTML file has a standard skeleton:
| Part | Purpose |
|---|---|
<!DOCTYPE html> |
Tells the browser "this is modern HTML5" |
<html lang="en"> |
The root element; lang helps screen readers and search engines |
<head> |
Information about the page (title, settings, links to CSS); not shown on the page |
<meta charset="UTF-8"> |
Supports every language and emoji 🎉 |
<meta name="viewport"> |
Makes the page work properly on phones |
<title> |
Text shown in the browser tab and in search results |
<body> |
Everything visible on the page |
Attributes
Attributes add extra information to an element. They go inside the opening tag as name="value".
Empty (void) elements
Some elements have no content and no closing tag:
Comments
Making it real on your computer
- Create a folder and a file called
index.html. - Paste the full skeleton from above into it, using any editor (VS Code is free and excellent).
- Double-click the file. It opens in your browser. That's a website!
Whitespace doesn't matter. Extra spaces and new lines collapse into a single space. Indent your code to make it readable for humans; the browser doesn't care.
Practice
Build an "About me" page with your name as an <h1>, two paragraphs about yourself, and a horizontal rule between them.
1.Where does content that's visible on the page go?
2.What is href in <a href="...">?