To format the code in Visual Studio when you want, press: (Ctrl + K) & (Ctrl + F)
The auto formatting rules can be found and changed in: Tools/Options --> (Left sidebar): Text Editor / CSS (or whatever other language you want to change)
For the CSS language the options are unfortunately very limited. You can also make some changes in: .../ Text Editor / All Languages