Guess what: we can also use margins to position elements.

If we set an element's margins to auto, it uses 0px on the top and the bottom and the whole available space on the right and left side.

<html>
 <head><style>p {background: #44b3c2;width: 150px;margin: auto;}</style></head><body><p>Put me in the center of attention.</p></body></html>
]]>

Isn't that great? By setting the right and left margins to auto, we can place an element in the horizontal center of its parent.

Didn't we want to see what happens if we set the element's margins to auto?