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






About The Author

Suprotim Agarwal
Suprotim Agarwal, Developer Technologies MVP (Microsoft Most Valuable Professional) is the founder and contributor for DevCurry, DotNetCurry and SQLServerCurry. He is the Chief Editor of a Developer Magazine called DNC Magazine. He has also authored two Books - 51 Recipes using jQuery with ASP.NET Controls. and The Absolutely Awesome jQuery CookBook.

Follow him on twitter @suprotimagarwal.

1 comment:

Anonymous said...

awesome. Thanks