Grow your CSS skills. Land your dream job.

center img horizontally

  • # January 25, 2010 at 7:22 pm

    I need to center my images in this slideshow but I don’t want to rely on knowing the image size. I have tried the

    Code:
    display: block;
    margin-left: auto;
    margin-right: auto

    method but it isn’t working for some reason. I’m either missing something silly or the slideshow is causing a problem. Thanks in advance for the help.

    Relevant HTML:

    Code:













    Relevant CSS:

    Code:
    /*Slideshow*/

    .slideshow {
    height: 370px;
    width: 370px;
    text-align: center;

    }

    img.cernterpic{
    display: block;
    margin-left: auto;
    margin-right: auto
    }

    link to page:
    http://kyam.ca/#2
    Link to stylesheet:
    http://kyam.ca/stylesheets/coda-slider-2.0.css

    # January 26, 2010 at 9:48 am

    Typo!!
    In the HTML you are calling
    <img class="centerpic"
    In the CSS you have called it
    img.cernterpic{

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".