Visual Studio Code doesn't have HTML validation by default. But it allows you to add extensions and enable these features.

To add HTML validation (linting), open Visual Studio Code, and then press Ctrl + P. Then paste ext install HTMLHint in it, and press Enter. It will install an HTML validator. You may need to reload Visual Studio Code to load the extension.

Now if you open the same HTML document you had the syntax error in, you should see there's an issue shown at the status bar at the bottom :), and it will also show you the errors in those lines.

Answer from Nimeshka Srimal on Stack Overflow
๐ŸŒ
Html-validate
html-validate.org โ€บ usage โ€บ vscode.html
HTML-validate - VS Code Extension
To get validation directly in VS Code use the HTML-Validate extension:
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
W3C Web Validator - Visual Studio Marketplace
Extension for Visual Studio Code - Check the validity of your HTML/CSS files in one click
Top answer
1 of 6
92

Visual Studio Code doesn't have HTML validation by default. But it allows you to add extensions and enable these features.

To add HTML validation (linting), open Visual Studio Code, and then press Ctrl + P. Then paste ext install HTMLHint in it, and press Enter. It will install an HTML validator. You may need to reload Visual Studio Code to load the extension.

Now if you open the same HTML document you had the syntax error in, you should see there's an issue shown at the status bar at the bottom :), and it will also show you the errors in those lines.

2 of 6
9

Visual Studio Code by default supports code formatting and it tracks the syntactical errors. If you create a new file and directly try to write the code then Visual Studio Code would not be able to understand which language or type of syntax the user wants to format or correct.

So, one first needs to save the new file with the proper extension, and then Visual Studio Code can properly identify the syntax.

The code formatting is available in Visual Studio Code through the following shortcuts:

  • On Windows Shift + Alt + F
  • On Mac Shift + Option + F
  • On Ubuntu Ctrl + Shift + I

You can add Auto Close Tag from the Visual Studio Code marketplace.

Launch Visual Studio Code Quick Open (Ctrl + P), paste the following command, and press Enter.

  1. Automatically add the HTML/XML close tag, the same as Visual Studio IDE or Sublime Text

    ext install auto-close-tag
    
  2. Visual Studio Code integration for HTMLHint - A Static Code Analysis Tool for HTML

    ext install HTMLHint
    
  3. Provides CSS class name completion for the HTML class attribute based on the CSS files in your workspace. It also supports React's className attribute.

    ext install html-css-class-completion
    
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
VS Code W3C Validation extention
Extension for Visual Studio Code - Adds W3C validation support to Visual Studio Code.
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
HTML Checker - Visual Studio Marketplace
Extension for Visual Studio Code - Checks HTML code using the W3C Markup Validation Service.
Find elsewhere
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
W3C Offline HTML Validator - Visual Studio Marketplace
Extension for Visual Studio Code - A VSCode extension for offline HTML validation using W3C standards.
Top answer
1 of 6
92

Visual Studio Code doesn't have HTML validation by default. But it allows you to add extensions and enable these features.

To add HTML validation (linting), open Visual Studio Code, and then press Ctrl + P. Then paste ext install HTMLHint in it, and press Enter. It will install an HTML validator. You may need to reload Visual Studio Code to load the extension.

Now if you open the same HTML document you had the syntax error in, you should see there's an issue shown at the status bar at the bottom :), and it will also show you the errors in those lines.

2 of 6
9

Visual Studio Code by default supports code formatting and it tracks the syntactical errors. If you create a new file and directly try to write the code then Visual Studio Code would not be able to understand which language or type of syntax the user wants to format or correct.

So, one first needs to save the new file with the proper extension, and then Visual Studio Code can properly identify the syntax.

The code formatting is available in Visual Studio Code through the following shortcuts:

  • On Windows Shift + Alt + F
  • On Mac Shift + Option + F
  • On Ubuntu Ctrl + Shift + I

You can add Auto Close Tag from the Visual Studio Code marketplace.

Launch Visual Studio Code Quick Open (Ctrl + P), paste the following command, and press Enter.

  1. Automatically add the HTML/XML close tag, the same as Visual Studio IDE or Sublime Text

    ext install auto-close-tag
    
  2. Visual Studio Code integration for HTMLHint - A Static Code Analysis Tool for HTML

    ext install HTMLHint
    
  3. Provides CSS class name completion for the HTML class attribute based on the CSS files in your workspace. It also supports React's className attribute.

    ext install html-css-class-completion
    
๐ŸŒ
LinkedIn
linkedin.com โ€บ all โ€บ engineering โ€บ web development
What is the HTML Validator extension for Visual Studio Code, and how can you use it to debug web development?
September 29, 2023 - Learn how to use the HTML Validator extension for Visual Studio Code to check, fix, and validate your HTML code for web development.
๐ŸŒ
YouTube
youtube.com โ€บ andrรฉ casal
VS Code Setting: html.validate.scripts - YouTube
Want to master VS Code? Click here: https://andrecasal.com/courses/mastery-for-vs-codeWant to upgrade web dev skills? Subscribe to the newsletter here: https...
Published ย  October 1, 2019
Views ย  947
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
CSSTree validator - Visual Studio Marketplace
Extension for Visual Studio Code - Validate CSS according to W3C specs and browser implementations
๐ŸŒ
Visual Studio Code
code.visualstudio.com โ€บ docs โ€บ languages โ€บ html
HTML in Visual Studio Code
November 3, 2021 - Go to the Extensions view (โ‡งโŒ˜X (Windows, Linux Ctrl+Shift+X)) and type 'html' to see a list of relevant extensions to help with creating and editing HTML. Tip: Click on an extension tile above to read the description and reviews to decide which extension is best for you. See more in the Marketplace. ... CSS, SCSS, and Less - VS Code has first class support for CSS including Less and SCSS.
๐ŸŒ
Reddit
reddit.com โ€บ r/vscode โ€บ htmlhint, html-validate or linthtml
r/vscode on Reddit: HTMLHint, HTML-validate or LintHTML
November 6, 2022 -

Hello! Is there a popular choice amongst these three for VSCode?

HTMLHint, HTML-validate and LintHTML are the ones I have found to work, but don't really know how they go with pros and cons. Appreciate any input on this.

๐ŸŒ
Read the Docs
vscode-docs1.readthedocs.io โ€บ en โ€บ latest โ€บ languages โ€บ html
HTML Programming in VS Code - vscode-docs1
"html.validate.styles": true ยท To improve the formatting of your HTML source code, press kb(editor.action.formatSelection) and the selected area will be reformatted.
๐ŸŒ
GitHub
github.com โ€บ celian-rib โ€บ vscode-webvalidation-extension
GitHub - celian-rib/vscode-webvalidation-extension: Web files W3C compliance check for VSCode | +200k Installs ยท GitHub
Web files W3C compliance check for VSCode | +200k Installs - celian-rib/vscode-webvalidation-extension
Starred by 23 users
Forked by 3 users
Languages ย  TypeScript
๐ŸŒ
Visual Studio Marketplace
marketplace.visualstudio.com โ€บ items
W3C Validator - Visual Studio Marketplace
Extension for Visual Studio - Validates any ASP.NET web application using the W3C validator on the rendered DOM running in the browser
๐ŸŒ
Reddit
reddit.com โ€บ r/vscode โ€บ vscode & html-validate
r/vscode on Reddit: vscode & html-validate
June 19, 2022 -

I'm trying to configure html-validate so I can ignore certains rule and I'm struggling.

I've installed the extension, validation is working correctly, and the config file is working.
(I've changed from "html-validate:recommended" to "html-validate:standard")

.htmlvalidate.json was generated and seem to work correctly.

Bt I cannot figure out how do I exclude a rule ?? For example I would like to turn off the rule:
no-inline-style

Thanks !