The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Center multiple images (gallery) inside div Reply To: Center multiple images (gallery) inside div



Assuming the images are still display:inline then text-align:center on the display:table-cell element will center them horizontally.

#gallery {
    display: table-cell;
    vertical-align: middle;

Be careful with large widths and large heights. 1500px fixed width is too wide and these days you really should be aiming for a fluid width (by all means set a max-width but allow the page to scale smaller). Also be careful with heights as often you never know the height especially if a user zooms the layout or in a fluid environment content will wrap and the height will need to increase. Generally it is your content that dictates the height and not the other way around. Of course there are always exceptions to the rule :)