Q:

What is the proper way to format a posts in Stack Overflow?

I have been using Stack Overflow for quite a while now and have edited lots of post. 
Each time I edit a post, I end up formatting the code parts by pressing space 4 times so that it formats the codes properly (in the right way, with the grey background) (hoping you guys got what I mean). 
Is it the right way? Since pressing space 4 times in each line of code is bugging me, is there any easier way, or some thing to read on?

A:

You can do this in two way
1st : Select whole code and hit code button

2nd : use this (``) for separate it as code
 

A:

Hitting the "code" button on the markdown editor will allow you to indent/outdent the whole block.
I also use my IDE to format larger blocks/bigger problems (CTRL+K+D for Visual Studio users). This can save time, and also helps to catch syntax errors which the OP may have missed. I don't correct such errors (to preserve the integrity of the question), but it may help me propose a solution or leave a helpful comment.
JS Fiddle's "TidyUp" option (recently added) can be handy if you are already have it open and the question pertains to JavaScript, HTML, or CSS. 

