Do I have to set top and bottom margin to 0 in order to set left and right margin auto?

Even if I set top/bottom margin to something else besides 0, will it still work with ‘auto’?
Also, can I set the height of the content and set top/bottom margin to auto?

Hi @ye-wonl8998422915
margin: auto; just works horizontally.
You can set the horizontal margin to auto and apply any value to margin-top and margin-bottom.
Shorthand could be like this:

margin: 0 auto; 
/* equals 
margin-top: 0; 
margin-right: auto;
margin-bottom: 0;
margin-left: auto;
*/

You could also write:

margin: 5% auto 10px; 
/* equals 
margin-top: 5%; 
margin-right: auto;
margin-bottom: 10px;
margin-left: auto;
*/