views:

433

answers:

4

Hi there,

I want to format my css files used in my web project.

Formatting means: Compress/Uncompress CSS file

Example:

*{margin:0;padding:0;}body{min-height:101%;font:69%/141% Arial,Helvetica,sans-serif;color:#2d3742;}

to:

* {
  margin: 0;
  padding: 0;
}
body {
  min-height: 101%;
  font: 69%/141% Arial,Helvetica,sans-serif;
  color: #2d3742;
  text-align: center;
  background: #fff url('../gfx/bgs/bg-body.gif') repeat-x;
}

It is pretty easy to do this with TextMate which I'm using at home. But how can I do it with Visual Studio? (couldn't find that feature) Or if there is no way to do it with VS, is there any windows program your aware of that is providing this feature?

Thanks a lot.

+2  A: 

If I understand your question, you can well form the doc with key sequence

ctrl + k + d in Visual Studio

....

Thanks Jonathan Sampson for the <kbd> tags :)

gmcalab
+1 good answer. To the OP, you can use CTRL+K+D to format almost any file type (CSS, HTML, ASPX, XML, C#, VB, ETC). CTRL+K+F is an alternate keystroke which will format only the highlighted area.
KP
@KP Cool I didn't know the alternate one, thanks for the tip. +1
gmcalab
+1  A: 

You can compress these quickly online with the CSS Compressor. And fix the compression using the answer provided in another solution: ctrl+k+d.

Jonathan Sampson
+1  A: 

http://www.lonniebest.com/FormatCSS/

LonnieBest
A: 

how can I compress the html or css code?

Example:

from (a well formatted css)

* { margin: 0; padding: 0; } body { min-height: 101%; font: 69%/141% Arial,Helvetica,sans-serif; color: #2d3742; text-align: center; background: #fff url('../gfx/bgs/bg-body.gif') repeat-x; }

to (compressed css)

*{margin:0;padding:0;}body{min-height:101%;font:69%/141% Arial,Helvetica,sans-serif;color:#2d3742;}

Zain Shaikh