Forums

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

Home Forums CSS Center aligning a group of images

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #187134
    WebNZ
    Participant

    Hi Everyone,

    I’m very new to web design and I’m having a few issues with the layout of a group of four images. You can see what I have done at http://www.loftnz.com.

    I have the images grouped and placed nicely but they are not quite centered. As you can see they “pull” slightly to the left. I’m assuming this has something to do with using the “float:left” command? Well that’s my guess….

    I have tried many many different things to correct this problem but still it remains. I can post the CSS here if that would help.

    Any advice gratefully accepted with thanks.

    Kind Regards,

    Sean.

    #187135
    Paulie_D
    Member

    I have tried many many different things to correct this problem but still it remains. I can post the CSS here if that would help.

    We’d rather you’d make a reduced case example in Codepen. Only include enough HTML & CSS to demonstrate the issue.

    If it was me though, I don’t use floats when I know I’m going to be centering elements. I use display:inline-block and text-align:center on the wrapping element.

    #187136
    WebNZ
    Participant

    Many thanks. I’ll give it a try. Will post to Codepen once I figure out how the site works.

    #187137
    __
    Participant

    Rather than floating your images (which is obviously not what you’re trying to do, here), just usedisplay: inline-block on the figures* and text-align: center on the parent section.

    * is there a reason you’re wrapping the images in figures?

    edit
    Sorry, I just realized that I’m basically just repeating Paulie_D’s advice. Consider it an endorsement.

    I seem to be having problems with reading comprehension today…

    #187138
    WebNZ
    Participant

    Magic Sudo! Thank you very much. That solved the problem. :)

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.