SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Jun 20, 2006, 13:27 #1
- 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
-
Jun 20, 2006, 14:16 #2
- Join Date
- Jan 2003
- Location
- Hampshire UK
- Posts
- 40,556
- Mentioned
- 183 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 }
-
Jun 20, 2006, 17:37 #3
- 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.
Bookmarks