navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Page and background not centering

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> Page and background not centering
Page: [1]
 
ncriptide

 

Posts: 17
Joined: 10/2/2007
Status: offline

 
Page and background not centering - 11/24/2007 10:54:12   
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.
Tailslide

 

Posts: 5915
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: Page and background not centering - 11/24/2007 14:09:43   
I can't check at the moment but if you haven't used a DOCTYPE then IE6 will be behaving like IE 5 (it'll be in quirks mode) and one of the side effects of this is that it will be using older rules for styling. You should really add a DOCTYPE (haven't got the link here but google "fix your site with the right doctype" to get a list).

You will also need to replace the "text align="left"' in the body rule with "text-align="center". Now add "text-align="left"" to the wrapper div. The centralising rule on the body will centralise everything for the older browsers and the text-align left on the wrapper will normalise the text again.

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to ncriptide)
ncriptide

 

Posts: 17
Joined: 10/2/2007
Status: offline

 
RE: Page and background not centering - 11/24/2007 17:41:49   
Problem solved!

Had to add the following to the wrapper div:

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

Along with your suggestion of:

body { text-align:center; }
#wrapper { text-align:left; }

Everything is smelling like roses on IE 5 & 6 now . . . thanks for all your help!!!!!

(in reply to Tailslide)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> Page and background not centering
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts