Jump to content

position my content to the center of the page


xbl1

Recommended Posts

Hello;i am trying to put a content of my page sit in the center of the my page it doesn't matter what browser is. but i just can do it for firefox, netscap and Opera browser, but i could not do it for IE browser. In the IE browser, my content of the page sit in the left side of the page.My IE file vision is 7.0.6Could anyone help, thanks.my code as following:

<html><head><style type="text/css">   #container{	  position: relative;	  width: 586px; /* width + border for IE 5.x */	  w\idth: 580px; /* real width */	  border: solid #036;	  border-width: 0 3px;	  margin: auto;   }</style></head><body><div id="container"><p>Skip navigation</p><ul>	<li><a href="">Home</a></li><li><a href="">About</a></li><li><a href="">Contact Us</a></li><li><a href="">Site map</a></li></ul>The OriginAfter getting back from his jaunt, Charles started work on his theory of evolution. Distracted by games of Reversi, Freecell and Solitaire on his computer, he took quite a while but then he heard that some Australian bloke named Wallace had come up with a similar idea so he got a move on to prevent his thunder being stolen.In 1858 Darwin and Wallance presented a joint paper to the Linnean Society of London that sent rumbles across the establishment and really quite upset a lot of people. The next year saw the publication of Darwin's 500-page 'abstract' - 'On The Origin of Species by Means of Natural Selection or the Preservation of Favoured Races In The Struggle For Life' (or OTOOSBMONSOTPOFRITSFL for short).</div></body></html>

Link to comment
Share on other sites

make the body text-align:center (and make the #container text-align:left)

Link to comment
Share on other sites

Well, it took a few minutes to figure out, I messed with it a bit, and got it...all you have to do is add

body {}

to your css, you don't even need anything in it..but you do need it there for the site to center

Link to comment
Share on other sites

>make the body text-align:center (and make the #container text-align:left)it just ok for IE, not for Firefox, Netscape and Opera.but if i add body{ text-align: center;}it will ok for the four browsers.

Link to comment
Share on other sites

You can't put the center tag outside the body tag...

<body><center>..</center></body>

Link to comment
Share on other sites

"margin: 0 auto;" is used by Modern Browsers "text-align: center;" is used by older IE browsers that got it wrong. (and apparently IE8 hasn't fixed it either)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...