root@coding-prodigies:~# โ–Š
// lesson 2 of 14 ยท 12 min

Your first HTML page

โš‘ Report an issue with this lesson

Every HTML document follows the same basic skeleton. Open a text editor, create a file called index.html, and type this exactly:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>My First Page</title>
</head>
<body>
  <h1>Hello, world!</h1>
</body>
</html>

Save it and open it in a browser (double-click the file). You should see a single line of text: "Hello, world!"

What each part does

  • <!DOCTYPE html> tells the browser this is a modern HTML document.
  • <html> wraps the entire page.
  • <head> holds information about the page -- nothing in here is visible on the page itself.
  • <body> holds everything the visitor actually sees.

Almost every HTML tag comes in a pair: an opening tag (<h1>) and a closing tag (</h1>), with content in between.

Try it yourself

Exercise: Add an &lt;h1&gt; with your name and a &lt;p&gt; with a short bio inside the body.
html
Live preview
// free preview

11 more lessons โ€” including Project: build a simple portfolio page โ€” plus a certificate are waiting.

Unlock the full course โ€” $29.99