CSU Ram Head Logo

JTC 372

Web Design and Management

CSS centering

A block element to be centered inside whatever contains it should have the following CSS declarations:

margin-right: auto;
margin-left: auto;

If an element is inline by default (e.g., an image), it can be made block with the following CSS declaration:

display: block