Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Old 11-24-2007, 10:51 AM Page not centering
ncriptide's Avatar
Skilled Talker

Posts: 72
Name: Reggie Byrum
Location: Charlotte, NC
Trades: 0
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: http://www.hudsontrailers.com

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.
ncriptide is offline
Reply With Quote
View Public Profile Visit ncriptide's homepage!
 
 
Register now for full access!
Old 11-24-2007, 02:43 PM Re: Page not centering
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
You need to set body to have 'text-align:center;'. This will centre it in IE, then set your div to 'text-align:left;' to correct the text alignment inside it.
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Old 11-24-2007, 05:45 PM Re: Page not centering
ncriptide's Avatar
Skilled Talker

Posts: 72
Name: Reggie Byrum
Location: Charlotte, NC
Trades: 0
Thanks so much!

Did what you suggested and also added the following to the wrapper div:

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

Works like a charm now in IE 5 & 6!

Thanks for your help - I really appreciate it.
ncriptide is offline
Reply With Quote
View Public Profile Visit ncriptide's homepage!
 
Old 11-25-2007, 10:53 AM Re: Page not centering
erthy's Avatar
Junior Talker

Posts: 3
Name: E West
Trades: 0
Quote:
Originally Posted by ncriptide View Post
Thanks so much!

Did what you suggested and also added the following to the wrapper div:

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

Works like a charm now in IE 5 & 6!

Thanks for your help - I really appreciate it.
That works well unless the user's screen resolution is smaller than the layout, it will slide off the screen without a scrollbar.
erthy is offline
Reply With Quote
View Public Profile
 
Old 11-26-2007, 01:20 PM Re: Page not centering
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Using position:absolute that way is so UNnecessary and not the optimum way to do things.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 11-27-2007, 08:16 PM Re: Page not centering
Average Talker

Posts: 29
Name: John
Location: Delaware
Trades: 0
On the container type, margin-right : auto and margin-left : auto (should center by itself)
turtile is offline
Reply With Quote
View Public Profile
 
Old 11-28-2007, 02:58 PM Re: Page not centering
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Yes, in most browsers except IE6 and below, for those you need the text-align: center on the body.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Page not centering
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.70121 seconds with 12 queries