Visual studio 2017 disable css formatting unnecessary spaces

Viewed 3078

I have a problem when I trying to format css code. Visual studio gives me unnecessary spaces in css

Before format css code in visual studio :

.test-parent {
}

.test-parent .test-child {
}

.test-parent .test-child .test-child-child {
}

After format css code in visual studio :

.test-parent {
}

    .test-parent .test-child {
    }

        .test-parent .test-child .test-child-child {
        }

Is it possible to disable unnecessary spaces in visual studio 2017 ?

1 Answers

I believe this feature is called "Hierarchical Indentation".

You should be able to disable it by completing the following.

  • Click the Tools menu
  • Click Options...
  • Scroll down and expand Text Editor
  • Scroll down and expand CSS
  • Select Advanced
  • Set Hierarchical indentation to "Off".

This should stop Visual Studio formatting your CSS in the nested format.

Related