Unit 2 of 15

Your First HTML Document

Updated Jun 2026

HTML or Hypertext Markup Language is the skeleton of every webpage. In about 5 minutes, you’ll write some yourself!

Step 1: Create the file

Open any plain-text editor (example: notepad for windows, textedit for Mac). Create a new file and save it as test.html. The .html extension is what tells browsers that this is a webpage.

Step 2: Add the boilerplate

Every html file stars with the same required boilerplate code. Copy this into your file as is. We’ll talk about what it means in a bit.

<!-- Tells the browser this is HTML5 -->
<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <title>My First Page</title>
  </head>

  <body>
    <!-- Your content goes here -->
  </body>

</html>

Step 3: Add your content

Replace <!– Your content goes here –> on line 11 by <p>My very first webpage!</p>.

<!-- Tells the browser this is HTML5 -->
<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <title>My First Page</title>
  </head>

  <body>
    <p>My very first webpage!</p>
  </body>

</html>

Step 4: Open it in a browser

Save your file. Then drag index.html into any browser window, or right-click the file and choose Open with → Chrome / Firefox / Safari. You should see your heading and paragraph rendered as a real webpage.

The address bar will show something like file:///Users/you/index.html — that’s normal. You’re running it locally, no server needed.

Practice time!

So… what is that boilerplate again?