VS code - How to auto format CSS?

Viewed 8464

I'm new to VS code and have been searching for a way to auto format CSS when saving data. Surprisingly, I can't seem to find any good extension or well-explained site of how to auto format CSS in VS code.

HTML is formatted the moment I saved a file, and want to do the same thing on CSS.

Ideally I want the one like "Beautify" that can be used in Atom.

Any advice?

1 Answers

Quite sure you can do this with prettier code formatter plugin. And you can set format on save true for all languages by adding the following to your user settings json file(dont forget to reload vscode after updating) :

"editor.formatOnSave": true,   

you can enable format on save for a specific language by adding the following too :

"[css]": {
    "editor.formatOnSave": true
}
Related