HTML · Chapter 2 of 45

HTML Editors

You can write HTML using any simple text editor, but code editors make the job easier with syntax highlighting, autocompletion, and error checking.

Popular choices include Visual Studio Code (free, most popular), Sublime Text, and even Notepad for absolute basics. Online editors like CodePen or JSFiddle let you experiment without installing anything.

Syntax
index.html

Local editors

VS Code is the most widely used editor for web development, offering extensions for live preview, formatting, and linting HTML.

Online editors

Sites like CodePen, JSFiddle, and StackBlitz let you write and preview HTML instantly in the browser, useful for quick tests and sharing.

Example 1 (html)
<!-- Save this as index.html and open it in a browser -->
<h1>Hello from my editor</h1>
Output
Hello from my editor

Save the file with a .html extension, then double-click to open in a browser.

Example 2 (html)
<p>Edited in VS Code</p>
Output
Edited in VS Code

Any text editor can create HTML files; the extension .html matters, not the tool.

Key points

  • Any text editor can write HTML.
  • VS Code is the most popular free code editor.
  • Online editors like CodePen allow instant previews.
  • Save files with the .html extension.
💡 Note: Install the 'Live Server' VS Code extension to auto-refresh your browser as you edit.

📝 Quick Quiz

1. Which is a popular free code editor for HTML?

2. What file extension should HTML files use?

3. What is CodePen mainly used for?