Forums

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

Home Forums CSS [Solved] Can't Center CSS "Polaroids" Photo Gallery within webpage

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #161836
    Dromascott
    Participant

    I’ve tailored this CSS Photo Gallery for my webpage but cannot get the ‘polaroids’ to center. I tried putting the whole section within a div and centering it but that didn’t work. Not sure where I’m going wrong here. Still very new at programming, so thanks in advance.

    (http://www.themusicshop.com/lessonmain2.asp “Music Shop Performing Arts Center”)

    (http://codepen.io/anon/pen/oxyAd “CodePen”)

    #161837
    chrisburton
    Participant

    I think you might want to start over. A lot of your markup and CSS will cause issues for you and is inefficient.

    #161839
    Dromascott
    Participant

    Which part of the CSS? Can you be more specific?

    #161840
    chrisburton
    Participant

    Is it completely necessary to use a grid system?

    This will fix the issue:

    .span-18 {
        width: 710px;
        margin: 0 auto;
    }
    

    And

    .container {
        position: relative;
        display: inline-block;
        font-size: 0;
    }
    
    #161843
    Dromascott
    Participant

    Well to be honest I’m not sure but, i love the way this gallery looks and functions. I need something editable and a bit interactive. If i can get them to the center that would great.

    #161844
    Soren
    Participant

    The div that contains the images has a class “column”. This class uses float: left and margin-right: 10px

    You’d want float:none and margin-right: 0 for the specific div you want centred.

    Edit: Or just remove the class “column” from the containing div and add a “clearfix” class!

    https://css-tricks.com/snippets/css/clear-fix/

    #161845
    chrisburton
    Participant

    Except that you’re using <br> tags like crazy. You’re using multiple divs to align things that could simply be done with a single element (wrap class). A lot of your markup is just not necessary.

    #161853
    Dromascott
    Participant

    Understood. I will work on cleaning up once i fix the centering issue. I’m still new at programming and learning on the go so I know my code is sloppy. Thanks guys

    #161854
    Soren
    Participant

    Hey did you not see this?

    http://codepen.io/soren-tree/pen/IuwgD

    #161855
    Dromascott
    Participant

    Yep I did. Thanks Soren

    #161860
    Dromascott
    Participant

    Fixed! Thank you very much. So basically it was column within a column and both were floating left?

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