TJS TJS - 1 year ago 64
CSS Question

What is the best practice for center aligning inline elements within a div?

For example if I have a parent div and 5 images I want to have centered within that div with a little margin around the images.

iiz iiz
Answer Source

Use the text-align css value on the container:

div {
text-align: center;

And apply the margin to each of the images inside:

div img {
margin: 5px;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download