Compact CSS formatting in Visual Studio

Visual Studio provides default formatting settings for the CSS Editor. You can provide style as well as capitalization formatting to your CSS code. Here’s how to do it

Open Visual Studio > Tools > Options > Text Editor > CSS > Formatting. There are 3 different formatting styles available: Compact Rules, Semi-expanded and Expanded

Here’s what each looks like

As you can see, ‘Expanded’ is the most readable but takes extra space. ‘Semi-expanded’ takes up lesser space than Expanded whereas ‘Compact rules’ takes minimum amount of space, but can be unreadable at times.

Similarly you can choose Capitalization formatting as shown below

I usually go with the Compact rules and Lowercase capitalization!

On a side note, you want also want to looks at 7 Free Tools to Minify your Scripts and CSS

1 comment: