According to Applied Visual Design: Center an Element Horizontally Using the margin Property, margin: auto;
should center block elements horizontally.
I searched in MDN, and h1
is a block element.
Why with:
h1 { margin: auto; }
isn’t centered but with `h1 { text-align: center; }, it is?
P.S. How to write multiline code?