Curriculum ▸ HTML Zero → Mastery ▸ Lesson 4: Install a Code Editor (VS Code) Foundations

Lesson 4 — Install a Code Editor (VS Code) Setup

Learning Goals

Part 1 — Install VS Code

Steps (all OSes)

  1. Go to code.visualstudio.com.
  2. Download the installer for your OS and run it.
  3. Launch Visual Studio Code.
Tip: During install on Windows, enable “Add to PATH” so you can run code . from the terminal.

First-run checklist

  • Open Command Palette (Ctrl/Cmd + Shift + P).
  • Search “Settings: Open Settings (UI)”.
  • Set Auto Save to “afterDelay”.

Part 2 — VS Code UI Tour

Main areas

  • Activity Bar — icons for Explorer, Search, Source Control, Run, Extensions.
  • Side Bar — changes with the active activity (Explorer shows files).
  • Editor — where you type code (tabs across the top).
  • Panel — Problems, Output, Terminal, Debug Console.
  • Status Bar — info + quick toggles (encoding, line endings, formatter, etc.).

Command Palette

Press Ctrl/Cmd + Shift + P and type a command name (e.g., “Toggle Word Wrap”).

Pro move: You can run any command from the Palette without hunting menus.

Part 3 — Create Your Workspace

  1. Create a folder named lesson-04 (put it next to your other lesson folders).
  2. Open the folder in VS Code: File → Open Folder… (or run code lesson-04 from a terminal).
  3. Create files: index.html, styles.css, app.js.
Starter HTML (copy/paste)
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Lesson 4 — VS Code Setup</title>
  <link rel="stylesheet" href="styles.css">
</head>
<body>
  <h1>VS Code is ready!</h1>
  <p>Live Server + Prettier installed.</p>
  <button id="ping">Ping Console</button>
  <script src="app.js" defer></script>
</body>
</html>
Starter CSS
body{font-family:system-ui;margin:1.25rem;line-height:1.6}
button{padding:.5rem .75rem;border:1px solid #ccc;border-radius:.5rem;cursor:pointer}
Starter JS
document.getElementById('ping').addEventListener('click', () => {
  console.log('VS Code ping ok!');
  alert('Hello from Lesson 4!');
});

Part 4 — Extensions: Live Server + Prettier

Install “Live Server”

  1. Open Extensions view (Ctrl/Cmd + Shift + X).
  2. Search Live Server and install.
  3. Open index.html, then click Go Live (Status Bar).
Result: Your browser opens and auto-refreshes whenever you save.

Install “Prettier”

  1. In Extensions, search Prettier - Code formatter and install.
  2. Open Settings and set Editor: Default FormatterPrettier.
  3. Enable Editor: Format On Save.
Result: Your HTML/JS/CSS will auto-format on save—clean and consistent.

Part 5 — Core Settings to Toggle

JSON (optional) — drop into settings.json
{
  "files.autoSave": "afterDelay",
  "editor.formatOnSave": true,
  "editor.wordWrap": "on",
  "editor.tabSize": 2,
  "editor.defaultFormatter": "esbenp.prettier-vscode"
}

Part 6 — Integrated Terminal

Open with View → Terminal (or Ctrl + `). It starts in your workspace folder.

# create a new lesson folder and open it
mkdir lesson-04 && cd lesson-04
code .
Tip: Keep the terminal docked at the bottom (Panel) so you can run commands without leaving VS Code.

Part 7 — Emmet Basics (built into VS Code)

Practice Tasks

  1. Open lesson-04/index.html and start Live Server. Confirm your page updates when you save.
  2. Break your formatting, then save; confirm Prettier fixes it.
  3. Add a <nav> with two links using Emmet, then style it in styles.css.
  4. Use the Command Palette to toggle word wrap and open settings.

Quick Quiz

  1. What does the Command Palette do?
  2. What’s the benefit of Format on Save with Prettier?
  3. Which extension provides auto-refresh in your browser while you edit?
  4. Where do you find the integrated Terminal in VS Code?
Sample answers
  • It lets you run any VS Code command by name.
  • Consistent, clean code formatting without manual effort.
  • Live Server.
  • In the Panel (View → Terminal or Ctrl + `).

Lesson 4 Dictionary

Activity Bar
Left-hand icon rail to switch VS Code views (Explorer, Search, SCM, Run, Extensions).
Auto Save
A setting that saves files automatically after a short delay.
Command Palette
Global launcher for VS Code commands (Ctrl/Cmd + Shift + P).
Editor
The main area where you edit files; supports tabs and split views.
Emmet
Abbreviation engine built into VS Code for fast HTML/CSS authoring.
Extension
A plugin that adds features to VS Code (e.g., Live Server, Prettier).
Explorer
The file tree view showing your workspace folders and files.
Integrated Terminal
A built-in terminal inside VS Code (View → Terminal or Ctrl + `).
Live Server
An extension that serves your page locally and auto-reloads on save.
Panel
Bottom region with Problems, Output, Terminal, and Debug Console.
Prettier
A code formatter used to enforce consistent style across files.
Settings
VS Code preferences accessible via UI or settings.json.
Status Bar
The bottom bar showing language mode, formatter, line endings, and more.
Tab Size
Number of spaces that a tab represents (course default: 2).
Visual Studio Code (VS Code)
A cross-platform code editor used throughout this course.
Workspace
Your project folder(s) opened in VS Code; holds settings and files for the lesson.
Word Wrap
A setting that visually wraps long lines instead of horizontal scrolling.