Search code examples
htmlvisual-studio-codeautoformatting

Autoindent <head> and <body> in VSCode


VSCode's formatter doesn't indent <head> and <body> tags by default. In the default settings the following lines exists:

// Indent <head> and <body> sections.
"html.format.indentInnerHtml": false,

I tried setting html.format.indentInnerHtml in the user settings to true but it didn't change anything.

This is what I get:

<html>

<head></head>

<body></body>

</html>

This is what I want:

<html>

    <head></head>

    <body></body>

</html>

Solution

  • I had the "JS-CSS-HTML Formatter" extension installed, which was causing the problems. After uninstalling it, everything now works as expected.