HTML Tutorial · HTML Basics · Lesson 2 of 34

HTML Get Started

Write HTML in an editor, save it as .html and open it in a browser.

What you need

Just a text editor and a web browser. A code editor like VS Code adds syntax highlighting, auto-closing tags and a "Live Server" extension that reloads the page as you type.

Create your first file

  1. Create a folder for your project.
  2. Create a file called index.html (the conventional name for a site's home page).
  3. Paste the page below, save, and double-click the file to open it in your browser.
index.htmlTry it yourself
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Hello</title>
</head>
<body>
  <h1>Hello from index.html!</h1>
  <p>Edit this text, save, and refresh the browser.</p>
</body>
</html>

View source and DevTools

Right-click any web page and choose View Page Source to see its HTML, or Inspect to explore the live element tree in the browser's developer tools — the best way to learn how other sites are built.

Publishing

To put a site online, upload your files to a host. Free options for static sites include GitHub Pages, Netlify and Cloudflare Pages.

Test yourself

What file name is conventionally used for a site's home page?

  1. home.htm
  2. main.html
  3. index.html
  4. start.html
Show answer

Answer: index.html