Why don’t margin-top: auto and margin-bottom:auto work the same as their left and right counterparts?

The short answer is the spec says so.

10.6.2 Inline replaced elements, block-level replaced elements in normal flow, ‘inline-block’ replaced elements in normal flow and floating replaced elements

If ‘margin-top’, or ‘margin-bottom’ are ‘auto’, their used value is 0.

http://www.w3.org/TR/CSS2/visudet.html#Computing_heights_and_margins

Leave a Comment