By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,648 Members | 1,203 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,648 IT Pros & Developers. It's quick & easy.

centering divs in middle of screen

P: 71
I've got a new site I'm working on. I'd like to give it the appearance that the page is centered in the middle of the screen, with white space on either side. Can anyone help me on how to handle this through the .css page? Any help would be greatly appreciated. Here's a link to the site: http://www.atlashvac.com/comfortteam/index.asp


here's the .css as I have it now:

/* css Indiana Comfort Team website default styles v1.01 */

body {
position: absolute;
left: 0px;
top: 0px;
margin: 0px 0px 0px 0px;
padding: 0px;
width: 100%;
height: 100%;
background-color: #006600;
}

/* ================================================== =================== */
/* Specific DIVs */
#banner {
position: absolute;
left: 0px;
top: 0px;
width: 1058px;
height: 150px;
voice-family: "\"}\"";
voice-family: inherit;
background-color: #FFFFFF;
z-index: 4;
}

#menu {
position: absolute;
left: 0px;
top: 150px;
width: 1058px;
height: 152px;
background-color: #FFFFFF;
z-index: 4;
}

#sidebar {
position: absolute;
left: 0px;
top: 302px;
width: 150px;
height: 100%;
background-color: #FFFF00;
z-index: 6;
}

#content {
position: absolute;
left: 150px;
top: 302px;
width: 908px;
height: 100%;
voice-family: "\"}\"";
voice-family: inherit;
background-color: #00CCFF;
z-index: 1;
}

/* ================================================== =================== */
/* Font Elements */

/* ================================================== =================== */
Apr 27 '07 #1
Share this Question
Share on Google+
4 Replies


P: 71
I actually got it to work in IE7, changing the positioning tab, and using the text-align trick. It doesnt' seem to be centered in Firefox though...
Apr 27 '07 #2

drhowarddrfine
Expert 5K+
P: 7,435
You will never get IE to pretend it's a modern browser like Firefox without a proper doctype. Right now you are in quirks mode. See the sticky at the top of this board. Use html4.01 strict. Then validate both your html and css for any errors.
Apr 27 '07 #3

P: 71
I've fixed all the bugs, but what would the proper doctype be for a .asp page? Would I just use the html doc type?
May 1 '07 #4

drhowarddrfine
Expert 5K+
P: 7,435
See the sticky at the top of this board about doctypes. The doctype is determined before any html is written and should always be strict. Whether it is created using asp or not does not matter.
May 1 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.