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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

margin-right/margin-left and auto 1

Status
Not open for further replies.

Rieekan

Programmer
Apr 2, 2001
737
US
Has anyone found instances where setting margin-right and left to auto will not center the page in IE? I cannot find any instances where this should be the case, but for some reason, it's happening. Some psuedo code is below.

Code:
<html>
<head>
<style>
#container { width: 760px; margin-right: auto; margin-left: auto; }
</style>
<body>
<div id="container">
page content goes here
</div>
</body>
</html>

Any help is appreciated!

- George
 
every single case!

do this:

Code:
<style type="text/css">
body { text-align: center; }
#container { width: 760px; margin-right: auto; margin-left: auto; text-align: right; }
</style>

*cLFlaVA
----------------------------
[tt]your mom goes to college[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Sometimes the simplest thing just eludes you. heh Should have thought of that.

Thanks!
 
I figured that's what you meant. Well, that's the way I implemented it anyway. heh

- George
 
In IE6, if you have a complete doctype at the top, you can however center a block level element using margins.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top