Click to See Complete Forum and Search --> : Centering site


burtonlive
03-26-2007, 04:02 PM
I know this is probably gonna be something simple, but my brain has been fried w/ other stuff going on. Can anyone tell me what needs to be done to get rid of the 72px margin on the left and actually center justify the page so that no matter what resolution it's in it will be centered?

Site:

http://smxtreme.com

jasonahoule
03-26-2007, 04:20 PM
Not as simple as you would think. It should be simple but all your styles are using fixed positions. There is no simple solution. You will have to change the site so it doesn't used fixed positions.

WebJoel
03-26-2007, 04:22 PM
You know that "position:absolute;" is 'out of the document flow' and every DIV I saw in there is 'absolute'. This needs to be made relative, define a width value, and then using "margin:0 auto;", it will center.

<div style="width:760px; margin:0 auto;" border:1px solid gray; >

</div>

is an example of a 'centered' DIV.

A valid !doctype is required too, for this to work.

burtonlive
03-26-2007, 06:20 PM
Cool, really appreciate the input guys! I'll work on a test site with the margin changed and see what happens.

What do you mean by the valid !doctype if you don't mind me asking? Bear with me guys, still a noob..

WebJoel
03-26-2007, 06:25 PM
What do you mean by the valid !doctype ..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
before "<html>"

A valid !doctype should be the first line on your web page. In it's absence, IE resorts to a state called "quirks mode", whereby it tries to 'guess' what you intended to write (often showing you pleasing results, -but incorrectly so).

burtonlive
03-26-2007, 08:18 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

This is what I've got on the pages, is this what you're referring to?

itHighway2007
03-26-2007, 09:09 PM
Yes I agree with burtonlive. His script would work.


http://www.ithighway.co.uk/