← HTML & CSS for Absolute Beginners: Build Your First Web Page
code
How Web Pages Work and Your First HTML File
When you open a website, your browser asks a server for a file, receives it, and displays it. For a simple page, that file is written in HTML (HyperText Markup Language). HTML is not a programming language. It is a way to mark up text so the browser knows what each part is: a heading, a paragraph, a link, an image.
What you need
- A web browser (Chrome, Edge, Firefox or Safari)
- A text editor. Notepad works, but VS Code (free) is nicer
Create your first page
- Create a folder called
my-first-page. - Inside it, create a file named
index.html. - Paste this in and save:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My First Page</title>
</head>
<body>
<h1>Hello, world!</h1>
<p>This is my first web page.</p>
</body>
</html>
- Double-click
index.html. It opens in your browser.
What each part does
<!DOCTYPE html>tells the browser this is modern HTML.<html>wraps the entire page.<head>holds information about the page (title, character set) that is not shown on it.<title>is the text on the browser tab.<body>holds everything visitors see.<h1>is the main heading and<p>is a paragraph.
Most elements have an opening tag (<p>) and a closing tag (</p>) with the content between them.
Your task
Change the heading and paragraph to be about you, save, and refresh the browser to see the change.