Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>HTML Preview OnlyNew to Visual Studio Code? Get it now.
HTML Preview Only

HTML Preview Only

Ederson Jr

|
371 installs
| (0) | Free
An extension to preview HTML and test code in real time.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

HTML Preview Extension for VS Code

Overview

The HTML Preview Only extension allows developers to preview their HTML files directly within Visual Studio Code. With a live preview that updates in real-time as you edit your file, this extension makes it easier than ever to visualize your changes instantly.

Compatibility

This extension is compatible with Visual Studio Code version 1.75.0 and above. Please ensure your VS Code installation meets this requirement.

Features

  • Live Preview: Automatically updates the preview pane as you edit your HTML files.
  • HTML Syntax Error Detection & Logging:
    • Parses your HTML to detect unclosed tags, mismatched tags, and other syntax errors.
    • Displays error messages in a dedicated output channel.
  • Automatic Path Resolution:
    • Dynamically rewrites local resource paths (CSS, JS, Images) using the vscode-webview-resource:// protocol to ensure that all resources load correctly within the preview.
  • Device Simulation:
    • Device Dropdown: Simulate different screen sizes by selecting from Desktop, Tablet, or Mobile.
    • Orientation Toggle: Switch between Portrait and Landscape modes with a fixed-width button to maintain a consistent layout.
  • Dark/Light Mode Switch:
    • Easily toggle between Light and Dark preview modes using a custom-styled switch.
    • The switch displays “Light” on the left and “Dark” on the right, allowing you to preview your HTML in different themes.
  • Responsive Preview Container:
    • The preview content adapts to the WebView size, ensuring seamless integration with VS Code.
  • Seamless Integration: Works directly in the VS Code editor, providing an intuitive and interactive workflow.

How to Use

  1. Install the Extension:
    Download the extension from the Visual Studio Code Marketplace or install it locally using the VSIX package.
  2. Open an HTML File:
    Open any HTML file you want to preview.
  3. Launch the Preview:
    Run the command HTML Preview: Open Html Preview by:
    • Pressing Ctrl+Shift+P (or Cmd+Shift+P on Mac) and selecting "Open Html Preview".
    • Or right-clicking in the editor and selecting Open Html Preview.
  4. Interact with the Toolbar:
    • Use the Device Dropdown to simulate different devices (Desktop, Tablet, Mobile).
    • Toggle the Orientation Button between Portrait and Landscape.
    • Switch between Light and Dark mode using the custom-styled switch.
    • The Media Query Label displays the current simulated device mode.

Installation

  1. From the Marketplace:
    Download and install the extension from the Visual Studio Code Marketplace.

  2. Local Installation:
    Package the extension into a VSIX file and install it locally with the following command:

   code --install-extension html-preview-only-{version}.vsix

Build Status

Build Status

Contributing

Feel free to submit pull requests or open issues on GitHub if you have suggestions for improvements or encounter any bugs.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft