iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-24-2007, 11:58 AM
ncriptide's Avatar
WebProWorld New Member
 
Join Date: Aug 2005
Location: Indian Trail, NC
Posts: 19
ncriptide RepRank 0
Default Page and background not centering

I'm a beginner CSS coder, so I'm sure I've done something extremely stupid:

I have a wrapper div that is 850px wide. I have set margins to: 0 auto;

It looks fine on a Mac running Firefox or Explorer, but when viewed on IE 5 or 6 on a PC, the background image is off and the site is flush left - not centered.

My header div is 800px wide and centered, and my main content dive is 800px and centered, so the background image of the wrapper will show on sides and top evenly.

Here's the url: Equipment trailers, flat bed trailers, deckover trailers, skid steer trailers, utility trailers, tilt trailers, auto hauler trailer, Hudson Bros Trailer Mfg

Here's the css:

body {
background-color:#003300;
font-family:Palantino "Times New Roman", Times, serif;
font-size: 1em;
text-align:left;
}

#wrapper {
background-image:url(../images/bkgnd.jpg);
background-attachment:fixed;
width: 850px;
height;
margin: 25px auto;
padding:25px 0;
}

#header {
background-color:#003300;
border-top:medium solid #FFFFFF;
border-right: medium solid #FFFFFF;
border-left: medium solid #FFFFFF;
width: 800px;
margin: 0 auto;
padding:0;

}
#main {
clear:both;
background-image:url(../images/images/main_bkgnd.jpg);
width:800px;
margin:0 auto;
padding:0;
border-left: medium solid #FFFFFF;
border-right: medium solid #FFFFFF;
border-bottom: medium solid #FFFFFF;
}

Any help would be greatly appreciated.
Reply With Quote
  #2 (permalink)  
Old 11-24-2007, 02:01 PM
WebProWorld Pro
 
Join Date: Aug 2003
Location: California,USA
Posts: 294
drummin RepRank 0
Default Re: Page and background not centering

Hi,

As you're going with fixed width, I'd "position" your outside container.
Something like this...

#wrapper {
background-image:url(../images/bkgnd.jpg);
background-attachment:fixed;
width: 850px;
position:absolute;
left: 50%;
margin-left: -425px;
padding-top: 25px;
}
Reply With Quote
  #3 (permalink)  
Old 11-24-2007, 02:16 PM
ncriptide's Avatar
WebProWorld New Member
 
Join Date: Aug 2005
Location: Indian Trail, NC
Posts: 19
ncriptide RepRank 0
Default Re: Page and background not centering

That did it!!!!

Thank you so much, . . . . . now, being a newbie to CSS, can you explain (as if you are explaining it to a rock) exactly "why" that worked?

I would have thought giving the wrapper a margin of

#wrapper {margin: 0 auto;} would have centered it. That's what I couldn't wrap my mind around.
Can you explain why simply adding:

position:absolute;
left: 50%;
margin-left: -425px;

did it for me? I really want to understand this. And what is the deal with margin-left: -425pz?

any insight would be appreciated.

Thanks again for solving my problem!!!!!!

Last edited by ncriptide; 11-24-2007 at 02:19 PM. Reason: typo
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS - centering div kruser Web Programming Discussion Forum 4 09-27-2007 04:38 PM
CSS- Centering a whole page and pixel positioning technica Graphics & Design Discussion Forum 16 12-25-2005 12:42 PM
Centering Pages -=DEUCE Graphics & Design Discussion Forum 4 08-23-2005 09:38 AM
Centering Left-Justified Text on the Page in Firefox beelzebob Graphics & Design Discussion Forum 1 03-05-2005 11:35 AM
Centering a PAGE for resolution size Thomas_Briggs Graphics & Design Discussion Forum 8 03-07-2004 08:54 PM


All times are GMT -4. The time now is 06:55 AM.



Search Engine Optimization by vBSEO 3.3.0