Grow your CSS skills. Land your dream job.

[Solved] Div No Longer Centered

  • # January 15, 2010 at 1:33 pm

    I’m using the coda-slider for my next site but I cant get my page wrapper to center the content. I did margin: 0 auto; but still no luck

    It was centered at one point but now its not.

    HTML:

    Code:
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">








    Rodgers Handyman Services

    Unfortunately your browser does not hava JavaScript capabilities which are required to exploit full functionality of our site. This could be the result of two possible scenarios:

    1. You are using an old web browser, in which case you should upgrade it to a newer version. We recommend the latest version of Firefox.
    2. You have disabled JavaScript in you browser, in which case you will have to enable it to properly use our site. Learn how to enable JavaScript.

    Home

    Remodeling and Handyman Services.
    Over 30 years experience.
    Licensed and Insured.
    Member of the Better Business bureau. Remodeling and Handyman Services.
    Over 30 years experience.
    Licensed and Insured.
    Member of the Better Business bureau. Remodeling and Handyman Services.
    Over 30 years experience.
    Licensed and Insured.
    Member of the Better Business bureau.
    Cras luctus fringilla odio vel hendrerit. Cras pulvinar auctor sollicitudin.
    Sed lacus quam, sodales sit amet feugiat sit amet, viverra nec augue. Sed enim
    ipsum, malesuada quis blandit vel, posuere eget erat. Sed a arcu justo. Integer
    ultricies, nunc at lobortis facilisis, ligula lacus vestibulum quam, id tincidunt
    sapien arcu in velit. Vestibulum consequat augue et turpis condimentum mollis
    sed vitae metus. Morbi leo libero, tincidunt lobortis fermentum eget, rhoncus vel
    sem. Morbi varius viverra velit vel tempus. Morbi enim turpis, facilisis vel volut
    pat at, condimentum quis erat. Morbi auctor rutrum libero sed placerat. Etiam ipsum
    velit, eleifend in vehicula eu, tristique a ipsum. Donec vitae quam vel diam iaculis
    bibendum eget ut diam. Fusce quis interdum diam. Ut urna justo, dapibus
    a tempus sit amet, bibendum at lectus. Sed venenatis molestie commodo.

    About

    Proin nec turpis eget dolor dictum lacinia. Nullam nunc magna, tincidunt eu porta in, faucibus sed magna. Suspendisse laoreet ornare ullamcorper. Nulla in tortor nibh. Pellentesque sed est vitae odio vestibulum aliquet in nec leo.

    Work

    Cras luctus fringilla odio vel hendrerit. Cras pulvinar auctor sollicitudin. Sed lacus quam, sodales sit amet feugiat sit amet, viverra nec augue. Sed enim ipsum, malesuada quis blandit vel, posuere eget erat. Sed a arcu justo. Integer ultricies, nunc at lobortis facilisis, ligula lacus vestibulum quam, id tincidunt sapien arcu in velit. Vestibulum consequat augue et turpis condimentum mollis sed vitae metus. Morbi leo libero, tincidunt lobortis fermentum eget, rhoncus vel sem. Morbi varius viverra velit vel tempus. Morbi enim turpis, facilisis vel volutpat at, condimentum quis erat. Morbi auctor rutrum libero sed placerat. Etiam ipsum velit, eleifend in vehicula eu, tristique a ipsum. Donec vitae quam vel diam iaculis bibendum eget ut diam. Fusce quis interdum diam. Ut urna justo, dapibus a tempus sit amet, bibendum at lectus. Sed venenatis molestie commodo.

    Contact

    Nulla ultricies ornare erat, a rutrum lacus varius nec. Pellentesque vehicula lobortis dignissim. Ut scelerisque auctor eros sed porttitor. Nullam pulvinar ultrices malesuada. Quisque lobortis bibendum nisi et condimentum. Mauris quis erat vel dui lobortis dignissim.

    < ! -- end of #pageWrapper -->


    CSS:

    Code:
    /*
    jQuery Coda-Slider v2.0 – http://www.ndoherty.biz/coda-slider
    Copyright (c) 2009 Niall Doherty
    This plugin available for use in all personal or commercial projects under both MIT and GPL licenses.
    */

    /* Insignificant stuff, for demo purposes */

    body { padding: 20px }
    .panel h2.title { margin-bottom: 10px }
    noscript div { background: #ccc; border: 1px solid #900; margin: 20px 0; padding: 15px }
    #pageWrapper{ margin: 0 auto; }
    /* Most common stuff you’ll need to change */

    .coda-slider-wrapper { margin: 0 auto; padding: 20px 0;}

    .coda-slider { background: #ebebeb }

    /* Use this to keep the slider content contained in a box even when JavaScript is disabled */
    .coda-slider-no-js .coda-slider { height: 300px; overflow: auto !important; padding-right: 20px }

    /* Change the width of the entire slider (without dynamic arrows) */
    .coda-slider, .coda-slider .panel { width: 800px}

    /* Change margin and width of the slider (with dynamic arrows) */
    /*.coda-slider-wrapper.arrows .coda-slider, .coda-slider-wrapper.arrows .coda-slider .panel { width: 600px }
    .coda-slider-wrapper.arrows .coda-slider { margin: 0 10px } */

    /* Arrow styling
    .coda-nav-left a, .coda-nav-right a { background: #000; color: #fff; padding: 5px; width: 100px }*/

    /* Tab nav */
    .coda-nav ul li a.current { background: #000;}

    /* Panel padding */
    .coda-slider .panel-wrapper { padding: 20px }

    /* Preloader */
    .coda-slider p.loading { padding: 20px; text-align: center }

    /* Don’t change anything below here unless you know what you’re doing */

    /* Tabbed nav */
    .coda-nav ul { clear: both; display: block; margin: auto; overflow: hidden; }
    .coda-nav ul li { display: inline }
    .coda-nav ul li a { background: red; color: #fff; display: block; float: left; margin-right: 1px; padding: 4px 7px; text-decoration: none }

    /* Miscellaneous */
    .coda-slider-wrapper { clear: both; overflow: auto }
    .coda-slider { float: left; overflow: hidden; position: relative }
    .coda-slider .panel { display: block; float: left }
    .coda-slider .panel-container { position: relative }
    /*.coda-nav-left, .coda-nav-right { float: left }
    .coda-nav-left a, .coda-nav-right a { display: block; text-align: center; text-decoration: none }*/

    Btw. The slider works great but I would like it centered. Any suggestions.

    # January 15, 2010 at 3:32 pm
    Code:
    #pageWrapper{ margin: 0 auto; }

    I’m pretty sure you need to define a width for your wrapper for that to work.

    # January 15, 2010 at 3:36 pm

    Oh i’m a dork. I completely overlooked that. Thanks for pointing that out.

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

You must be logged in to reply to this topic.

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