Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set a whole page center?

Status
Not open for further replies.

NMDUC

Programmer
Mar 4, 2006
61
VN
Hi,
I would like to put a whole page in the center despite the change of monitor's resolution.
I try to use this CSS
body
{
margin-right: 5%;
margin-left: 5%;
text-align : center;
}

#wrapper
{
width:900px;
text-align:left;
}

But it works only in IE. But in the FF, it does not run as I want. Please help me.

Thank in advance.
Duc
 
What you're using is an outdated and incorrect method that used to work in IE. To do it the correct way, change the #wrapper to read:
Code:
#wrapper
{
    width: 900px;
    text-align: left;
    [b][blue]margin: 0 auto;[blue][/b]
}
This should work in IE6, IE7 (in standards mode, not quirks mode) and all other modern browsers. You only need to keep your code in if you want to support IE browsers before 6.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top