SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Web Design Addict
    Join Date
    Mar 2004
    Posts
    2,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Half of my site is centered, other half not centered

    http://www.deronsizemore.com/test/index.html

    Well as you can see from the link, the #secondary section is not centered. I've used the same (or from what I can see, the same) CSS values/attributes for the #secondary section as I used for the top section. What am I leaving out that's causing it to be left aligned?

    Also, if someone has a better way to duplicate what I've got for the secondary section, I'm all ears. You can see I've added #secondarybg for the green gradient background image, but I'd just assume not to have that extrat #secondarybg div in there if there is a way around it? I started out putting the background image in the #secondary div, but since it is not 100% width, it was making the green gradient also not 100% width, so I'm looking for a bettery more efficient way to go about that...maybe I've got it?

    Thanks
    Deron Sizemore
    ----------
    My Sites: LogoGala | Golf Ledger (coming soon)
    Twitter: Deron Sizemore

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,471
    Mentioned
    182 Post(s)
    Tagged
    6 Thread(s)
    HI,

    You need a width in order to center when using margin:auto;

    Code:
    #secondary {
    margin: 45px auto 20px auto;
    text-align: left;
    padding: 0;
    width:760px
    }
    If you want a 100% width for the background image then you will need the extra div so that you have the 100% to play with.

  3. #3
    Web Design Addict
    Join Date
    Mar 2004
    Posts
    2,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, thank you Paul. I didn't realize that you needed the width in there. I always overlook the easy stuff.
    Deron Sizemore
    ----------
    My Sites: LogoGala | Golf Ledger (coming soon)
    Twitter: Deron Sizemore


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •