Dominik Hadl
Dominik Hadl

Reputation: 3619

How to align multiple images in "li" on center

I am doing a website and I don't know how to do aligning of images wrapped in < li >.

Here you can see the page - http://www.dansid.cz/praginfo/services.php?l=de

I need those images to automatically align on center, how can I do that with CSS?

You can see the CSS etc. by right clicking in Firefox or Chrome and clicking Inspect Element.

Thanks for your answers :)

Upvotes: 1

Views: 2295

Answers (2)

Andres I Perez
Andres I Perez

Reputation: 75409

By images in lis i assume you're referring to the thumbnails found in your site, you can center them by declaring them display:inline-block instead of float:left and then simply centering them in their container by setting the text-align:center property in it, like so:

#navlist li {
   display:inline-block;
   *display:inline; /* ie7 fix */
}

Note: remove the float property.

#navlist {
   text-align:center;
}

Upvotes: 2

jacktheripper
jacktheripper

Reputation: 14259

Try on the parent li text-align: center for li elements with a width larger than the images

If you want to align the whole ul to the center than I would suggest giving it the attributes:

margin: 0 auto;
display: block;
width: //your width;

Upvotes: 0

Related Questions