2 replies [Last post]
sahina
Offline
newbie
Last seen: 17 years 51 weeks ago
Joined: 2004-08-25
Posts: 2
Points: 0

Hi there,

I have a very simple page that drives me crazy... Here is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
background-color: #333333;
text-align: center;
}
#MainWrapper {
border: 2px solid #006699;
background-color: #FFFFFF;
width: 300px;
}
-->
</style>
</head>

<body>
<div id="MainWrapper">Content for id "MainWrapper" Goes Here</div>
</body>
</html>

When I preview this page Netscape doesn't center the DIV... Why not? Any ideas?
[/img]

sahina
Offline
newbie
Last seen: 17 years 51 weeks ago
Joined: 2004-08-25
Posts: 2
Points: 0

DIV tag centers differently in IE and Netscape

OK, I found the solution...

Apparently Netscape needs to have the top, right and left margins to render...

#MainWrapper {
	width: 780px;
	text-align: center;
	position: static;
	padding: 0px;
	margin-top: 0px;
	margin-right: auto;
	margin-left: auto;
}

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 18 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

DIV tag centers differently in IE and Netscape

You beat me to it! Tongue

The next sentence is true. The previous sentence is false. Discuss...