Centering page using CSS

SpaceshipSpaceship
Watch

MasterB

Awesomeâ„¢Established Member
Impact
3
Hey everyone, need some help here.
I'm designing a site for my group, and I'm having some problems. Most of all, dealing with the XHTML 1.0 Strict format that I'm using. This is my site being designed:
http://y1v.net/mbbsite/

In Internet Explorer, it looks fine. In Firefox, though, it is aligned to the left. I am currently using
Code:
<div style="text-align: center">
to center to center the entire contents of the body, but it seems this doesn't work in Firefox. Can anyone help me out?

The most important thing to me is to keep it XHTML 1.0 Strict, so I can't use
Code:
<div align="center">
or
Code:
<center>
tags. Thanks for the help.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
On your CSS file under the div you want to be centered make this code:
Code:
margin-left: auto;
margin-right: auto;

This will center it in Firefox but IE sucks so you have this under body
Code:
text-align: center;

Then under everything you don't want the text to be aligned in the center for just use this code:
Code:
text-align: left;

Hope this helps.
 
0
•••
A slightly shorter version of above:

Code:
body {
text-align: center;
}

#wrap {
margin: 0 auto;
text-align: left;
}
 
0
•••
OH ...! Thanks For Kind Help...g1c9
 
0
•••
You can also go to www.bluerobot.com and find a thing on how to center with CSS.
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
NameMaxi - Your Domain Has Buyers
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back