Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio is formatting my CSS/LESS in the way I don't want, how to turn it off?

Recently, my LESS file was reformatted in this way:

selector {
    some rules
}

    selector nested-selector {
        some other rules
    }

I don't want the nested rule to be indented, where can I turn it off? BTW this might be a Web Essentials thing, too, I have that extension installed. But couldn't find the corresponding settings anywhere.

like image 531
Borek Bernard Avatar asked Mar 14 '14 10:03

Borek Bernard


People also ask

How do I beautify CSS in Visual Studio?

press F1 or ctrl+shift+p and then enter beautify .. alt+shift+f did nothing, but typing beautify...

Why my CSS is not working in VS code?

Why my CSS file is not working in VS code? The problem may be that your browser is caching the CSS file. If you're debugging with Edge, you can open the F12 tools and click on the Network tab. At the top, you'll find a button to "always refresh from server." Turn this on, and files won't be cached.


1 Answers

Found it. Even for LESS, the rules from CSS editor settings apply and they can be found in Tools > Options > Text Editor > CSS > Advanced. Set "Hierarchical indentation" to Off.

like image 55
Borek Bernard Avatar answered Oct 06 '22 10:10

Borek Bernard