format html vscode code example

Example 1: html skeleton shortcut vs code

type "!" (exclamation mark) and press enter in vs code.

//below code will be generated
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>

Example 2: format code in vs code

On Windows Shift + Alt + F.
On Mac Shift + Option + F.

Example 3: visual studio code html template shortcut

First set HTML to the language
Then type:

html:5

And hit Tab

Voila, HTML Template in your favorite code editor!

Example 4: vscode auto format html

Format entire file: 
Ctrl + Shift + I

Example 5: vs code enable "html" in "javascript"

"emmet.includeLanguages": {
    "javascript": "javascriptreact",
    "vue-html": "html",
    "razor": "html",
    "plaintext": "pug"
}