HTML Editors
In this lesson
You can write HTML in any program that saves plain text. In this lesson you’ll create a real HTML file on your computer, open it in your browser, and then set up Visual Studio Code, the free editor most web developers use every day.
Option 1: The editor you already have#
Every computer comes with a simple text editor. It’s enough for your first page.
On Windows (Notepad)#
- Open the Start menu, type Notepad and open it.
- Type or paste the page below.
- Click File → Save As.
- Choose a folder (for example, Desktop).
- Set Save as type to All files.
- Name the file
index.htmland set Encoding to UTF-8. - Click Save.
On Mac (TextEdit)#
TextEdit saves rich text by default, which breaks HTML. Change that first:
- Open TextEdit → Settings (or Preferences).
- On the New Document tab, select Plain text.
- On the Open and Save tab, tick Display HTML files as HTML code instead of formatted text.
- Create a new document, type the page below, and save it as
index.html.
Here is the page to type:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My Computer Page</title>
</head>
<body>
<h1>It works!</h1>
<p>I wrote this file on my own computer.</p>
</body>
</html>
Open the file in a browser#
Find index.html in the folder where you saved it and double-click it. It opens in your default browser and shows your heading and paragraph.
Every time you change the file:
- Save it in the editor (
Ctrl + S, orCmd + Son Mac). - Switch to the browser and refresh (
F5, orCmd + Ron Mac).
That save-and-refresh loop is how you’ll work through this whole tutorial.
Option 2: Visual Studio Code (recommended)#
Notepad works, but a code editor makes HTML much easier. Visual Studio Code (VS Code) is free, works on Windows, Mac and Linux, and is used by most professional web developers.
What it does for you:
- Colours your code, so tags, text and attributes are easy to tell apart.
- Auto-completes tags: type
<pand it suggests the rest. - Closes tags for you, so you don’t forget
</p>. - Emmet shortcut: in a new
.htmlfile, type!and pressTabto get a full page outline instantly.
Set it up#
- Download VS Code from the official site, code.visualstudio.com, and install it.
- Create a folder for your practice files, for example
html-practice. - In VS Code choose File → Open Folder and select that folder.
- Click the New File icon and name it
index.html. - Type
!then pressTab. VS Code writes the page outline for you. - Add
<h1>Hello from VS Code</h1>inside the<body>, then save.
Live Server: refresh automatically#
The Live Server extension reloads the browser every time you save:
- Click the Extensions icon on the left (four squares).
- Search for Live Server and click Install.
- Right-click
index.htmland choose Open with Live Server.
Now every save updates the browser by itself, with no manual refresh needed.
Practising on VitalStack#
Every example in these lessons has a Try it Yourself button. It opens an editor right here in your browser: change the code on the left, press Run, and see the result on the right. It’s the quickest way to test a small idea. For anything you want to keep, use your own files.
Common mistakes#
- The page shows the code instead of the result. The file was saved as
.txtor rich text. Make sure the name ends in.htmland the format is plain text. - Strange characters (é instead of é). Save the file as UTF-8 and keep the
<meta charset="UTF-8">line in the<head>. - Changes don’t appear. You forgot to save, or to refresh the browser.
Exercise#
- Create a folder called
html-practicewith anindex.htmlfile inside it. - Write a page with your name as the
<h1>and one paragraph about yourself. - Open it in the browser, change the paragraph, save, and refresh to see the update.
Summary#
- HTML files are plain text files ending in
.html. - You can write them in Notepad or TextEdit, but VS Code is free and much easier.
- Open the file in a browser to see the result; save and refresh after every change.
- Save files as UTF-8 to avoid broken characters.
Next, you’ll learn what each part of the basic page structure means.
Quick quiz
3 questions. Check what stuck and earn 2 XP for each right answer.
Progress is saved in this browser. Create a free account to keep it on every device.
Get new lessons in your inbox
One email when we publish a new tutorial or guide. No spam, unsubscribe in one click.