Forums

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

Home Forums CSS Center images side by side in Div

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #28091
    suggy1982
    Member

    I know this is probably something very simple, but I need to align some images side by side across the page and then centre them within a div.

    Here is my CSS for the div and images:-

    Code:
    .twoColFixRtHdr #banner
    {
    height:120px;
    text-align:center;
    }
    .twoColFixRtHdr #banner img
    {
    border:solid 1px black;
    margin:10px 5px 10px 5px;
    float:left;
    }

    and here is my html:

    Code:

    But the images are still aligning to the left in the div,

    help please……

    #71286
    eip56
    Member

    A possible solution would be to place the images div within another div then do the margin: 0 auto; Not sure exactly understand the outcome you want a link to a test page would be helpful but this is what it might look like:

    Code:

    The css would like something like this:

    Code:
    #container #banner {
    margin: 0 auto;
    }

    #container #banner img {
    float: left;
    /* Then add individual styles for the images */

    That would probably get the outcome your looking for.

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