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

Will you give this article a +1 ? Thanks in advance

About The Author

Suprotim Agarwal
Suprotim Agarwal, ASP.NET Architecture MVP (Microsoft Most Valuable Professional) works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He is the Editor of a Developer Magazine called DNC Magazine. He has also written two EBooks 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