Home/Lessons/Your First HTML File
HTML BasicsBeginner10 min read

Your First HTML File

Create and open your first .html file. See your code in a real browser immediately.

0 / 31 lessons completed0%
YouTube video lessonYouTube

Lesson Content

Creating your first HTML file is simpler than you think. All you need is a plain text editor (like VS Code, Notepad, or TextEdit) and a web browser.

Step 1: Create the file Open your text editor and create a new file. Save it with the .html extension — for example, index.html. The name index is conventional for the main page of a website.

Step 2: Add the boilerplate Every HTML file starts with the same basic structure. This is called the HTML boilerplate. It tells the browser what kind of document it's reading and sets up the basic sections.

Step 3: Add your content Inside the <body> tag, add a heading and a paragraph. This is the content that will appear on screen.

Step 4: Open in a browser Double-click your index.html file. It will open in your default browser. You should see your heading and paragraph rendered as a real webpage.

Every time you save changes to your file and refresh the browser, you'll see the updated result. This is the core development loop you'll use throughout this course.

code example
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>My Website</title>
  </head>
  <body>
    <h1>Welcome to My Website</h1>
    <p>I built this with HTML!</p>
  </body>
</html>

Finished this lesson?

Mark it complete to track your progress through the course.

Learning Objectives

  • 1Create a valid .html file from scratch
  • 2Understand the required boilerplate structure
  • 3Open and preview your file in a browser
  • 4Make a live edit and see the result
Your Progress0%

0 of 31 lessons done

All Lessons