Greetings! I recently created a forum, but encountered an issue with page alignment. Despite setting the main element to margin: 0 auto;
, the content remained off-center. I also tried using margin-left:auto
and margin-right:auto
separately, but they didn't solve the problem.
Below is my HTML code:
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="main"><!--Begin Main-->
...
</div><!--End main-->
</body>
</html>
And here is my CSS code:
*{ margin:0;
padding:0;}
#main
{
width:800px;
margin-left:auto;
margin-right:auto;
}
body{background-color:#000; color:#FFF;}
#header
{
background:url(images/header.png) no-repeat;
}
...