Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can build a complete static website in Visual Studio Code with three files: index.html for structure, styles.css for presentation, and script.js for behavior. Install the desktop editor, open a project folder, create those files, preview the page with VS Code’s Integrated Browser or Microsoft’s Live Preview extension, and then publish the finished folder with a hosting service.

What Visual Studio Code does—and does not do

Visual Studio Code (VS Code) is a code editor and development workbench. It provides editing, language help, an integrated terminal, source-control features, debugging tools and an extension system. HTML, CSS and JavaScript are supported out of the box well enough for a first website.

It is not a website builder with a visual drag-and-drop canvas, a framework, a hosting service or a project-template catalog. Microsoft’s documentation explicitly notes that VS Code does not include a File > New Project dialog or preinstalled project templates. You bring the runtime, package manager and framework tools your project needs.

Choose the right VS Code edition

Desktop VS Code

Install desktop VS Code when you need a terminal, local development server, debugger, build tools or extensions that interact with your machine. A folder opened in the editor becomes the workspace used by the Explorer, terminal, source control and debugger.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

VS Code for the Web

The browser version is useful for browsing a repository and making lightweight edits without installing software. It does not provide a terminal or debugger, and only some extensions can run there. Use desktop VS Code (or a fuller remote development environment) for projects that must run a local build or debugging session.

Step 1: Install VS Code and create a workspace

  1. Download and install desktop Visual Studio Code for your operating system.
  2. Create a folder for the site, such as my-first-site. Put it somewhere you can find easily.
  3. Open VS Code and choose File > Open Folder, then select my-first-site.
  4. In the Explorer sidebar, confirm that the folder is shown as the workspace root.

If VS Code displays a Workspace Trust prompt for an unfamiliar folder, inspect its contents before choosing Trust. Workspace trust allows project code and tasks to run with fewer restrictions, so trust only sources you know.

Step 2: Create the HTML, CSS and JavaScript files

In Explorer, click New File and create these files:

  • index.html — the page structure and content.
  • styles.css — colors, layout, typography and responsive rules.
  • script.js — optional interactive behavior.

Start with this complete example. It creates a small landing page with a button that changes the message.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

index.html

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>My First Website</title>
  <link rel="stylesheet" href="styles.css">
</head>
<body>
  <header class="site-header">
    <a class="brand" href="index.html">My First Website</a>
    <nav aria-label="Main navigation">
      <a href="#about">About</a>
      <a href="#contact">Contact</a>
    </nav>
  </header>

  <main>
    <section class="hero">
      <p class="eyebrow">Built in Visual Studio Code</p>
      <h1>A simple site that you can change yourself.</h1>
      <p>Edit the HTML, CSS and JavaScript files, save them, and refresh the preview.</p>
      <button id="welcome-button" type="button">Show a welcome message</button>
      <p id="message" role="status"></p>
    </section>

    <section id="about" class="content-section">
      <h2>About this page</h2>
      <p>HTML supplies the content, CSS controls the appearance, and JavaScript adds behavior.</p>
    </section>

    <section id="contact" class="content-section">
      <h2>Contact</h2>
      <p>Replace this text with your email address or contact form.</p>
    </section>
  </main>

  <footer class="site-footer">© 2026 My First Website</footer>
  <script src="script.js" defer></script>
</body>
</html>

styles.css

:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #172033;
  background: #f5f7fb;
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.6; }
.site-header, .site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 6vw;
  background: #172033;
  color: white;
}
.site-header a { color: white; margin-left: 1rem; }
.brand { font-weight: 700; text-decoration: none; margin-left: 0 !important; }
.hero, .content-section { max-width: 760px; margin: 0 auto; padding: 5rem 6vw; }
.hero { min-height: 55vh; }
.eyebrow { color: #526dff; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
button { border: 0; border-radius: .5rem; padding: .8rem 1.1rem; background: #526dff; color: white; font: inherit; cursor: pointer; }
button:hover, button:focus-visible { background: #3d55d6; }
#message { min-height: 1.6em; font-weight: 700; }
@media (max-width: 600px) {
  .site-header { align-items: flex-start; flex-direction: column; gap: .75rem; }
  .site-header a { margin-left: 0; margin-right: 1rem; }
}

script.js

const button = document.querySelector('#welcome-button');
const message = document.querySelector('#message');

button.addEventListener('click', () => {
  message.textContent = 'Welcome! You changed the page with JavaScript.';
});

Save all three files with Ctrl+S on Windows/Linux or Cmd+S on macOS. Keep filenames and capitalization consistent: styles.css in the HTML must match the actual filename exactly, especially on case-sensitive systems.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Step 3: Preview the website in VS Code

Option A: Integrated Browser

Desktop VS Code’s HTML workflow can open an HTML file in its Integrated Browser. Open index.html, use the editor’s preview/open command, and inspect the page inside VS Code. Save an edit and reload the preview to see the result. This is a convenient direct preview for a simple static file.

A direct file preview is not the same as running an application server. Features that depend on HTTP requests, server-side code, routing or a build step may need a local development server instead.

Option B: Microsoft’s Live Preview extension

  1. Open the Extensions view with the square-tiles icon in the Activity Bar.
  2. Search for Live Preview.
  3. Check that the publisher is Microsoft, review the listing details, and select Install.
  4. Open index.html, then choose the Live Preview command shown by the extension (or use its preview button).

Microsoft’s beginner tutorial describes Live Preview as launching a local development server with live reload for static and dynamic pages. That means changes can appear in the browser as you save, without manually restarting a server. You do not need both preview routes; choose the Integrated Browser for a direct built-in preview or Live Preview when you want a server-based, auto-refreshing workflow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Step 4: Use VS Code’s editing help

  • Syntax highlighting: tags, properties and JavaScript expressions are colored so mistakes are easier to spot.
  • Completion: type an HTML tag, CSS property or JavaScript method and accept a suggested completion.
  • Diagnostics: red or yellow underlines identify many syntax and language problems.
  • Formatting: use the editor’s format command to keep indentation consistent.
  • Search and rename: search across the workspace when changing a class name or link target.

Extensions can add language support and tooling for frameworks, linters and formatters. Treat extensions as optional: use the Extensions view to inspect the publisher and details, and install only what your project calls for.

Step 5: Check the page before publishing

Content and links

  • Open every navigation link and confirm that anchors such as #about point to an element with the matching id.
  • Replace placeholder copy, update the title and add meaningful alternative text to informative images.
  • Use headings in logical order and label form controls.

Responsive behavior

Resize the preview window or use browser developer tools at narrow widths. Check that text remains readable, buttons are usable with a keyboard, navigation does not overflow and images do not extend beyond the viewport.

Asset paths

Keep images in a folder such as images/ and reference them with relative paths such as images/hero.jpg. A missing image or stylesheet usually means the path or filename does not match the workspace file.

Browser console

If a button does nothing, open the browser’s developer tools and inspect the Console. A JavaScript error or a failed script request commonly points to a typo in an element selector, a missing file or an incorrect path.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When a simple folder is no longer enough

A static HTML/CSS/JavaScript folder is appropriate for a small brochure site, portfolio or learning project. A larger application may need a framework, package manager, database, server runtime or bundler. Install the tools required by that stack separately, then use VS Code’s terminal to run the commands documented by that tool. VS Code does not supply those project dependencies automatically.

For example, if a framework’s official setup creates a project directory and development command, open that generated directory in VS Code rather than expecting an editor wizard to create it. Keep the terminal’s working directory at the workspace root so relative paths and scripts resolve correctly.

Common problems and fixes

The page shows unstyled HTML

Confirm that index.html contains <link rel="stylesheet" href="styles.css">, that the file is in the same folder, and that spelling and capitalization match. Reload the preview after saving.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

JavaScript does not run

Check the deferred script tag, the filename and the browser Console. In the example, script.js must be beside index.html, and the button’s id must remain welcome-button.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Live Preview cannot start

Make sure a folder, not just an individual file, is open as the workspace. Verify that the Microsoft Live Preview extension is installed and enabled, then close and reopen the preview. If the project needs a different runtime or server, use that project’s documented command in the integrated terminal.

VS Code asks whether to trust a folder

Read the prompt and inspect unfamiliar files first. Choose restricted mode when you do not trust the source; some tasks, terminals or extensions may then be limited.

An extension is unavailable in the browser editor

That is an expected limitation of VS Code for the Web: only some extensions run there, and there is no terminal or debugger. Move the folder to desktop VS Code or use a remote environment that supplies the missing capabilities.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a reliable image or PDF of a finished page rather than local design work, ScreenshotNeo can capture a public URL through one request. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets before the capture. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the page verdict and billing result in headers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

ScreenshotNeo also provides an MCP server for AI agents such as Claude and Cursor, with take_screenshot, get_page_info and capture_pdf tools. Every feature is available on every plan; the Free plan includes 1,000 shots each month with no card, and paid plans start at $5 for 3,000 shots.

After deploying your site to a public URL, call the API as shown in the ScreenshotNeo documentation:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the same request in Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Or Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Create a free ScreenshotNeo account to start with 1,000 screenshots a month and no card.

What to do after the first page works

  1. Replace the sample content with your own copy, colors and images.
  2. Split additional pages into files such as about.html and contact.html, then link them with relative URLs.
  3. Keep a backup or initialize source control from VS Code’s Source Control view.
  4. Choose a host that serves static files, upload the project folder, and test the public URL on both desktop and mobile.
  5. Use a framework or server runtime only when the site’s requirements justify its added setup.

Frequently Asked Questions

Can I build a website in VS Code without installing an extension?

Yes. Desktop VS Code can preview an HTML file with its Integrated Browser. An extension is optional; Microsoft’s Live Preview adds a local server and live reload.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do I need to know JavaScript to make a website?

No. HTML and CSS are enough for a static page. Add JavaScript only for behavior such as menus, validation or interactive controls.

Can VS Code publish my website?

VS Code edits and previews files but is not a hosting service. Upload the finished folder to a static host or deploy it through the hosting workflow required by your chosen platform.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.