Monday, August 29, 2011

Center HTML/Webpage

To center your webpage its simple. By setting the width and margin you can achieve this. However, depending on the browser (Internet Explorer) you must include the doctype or it will not work. See the code below


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<body>
<html>
<style>
#main {
width: 900px;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="main">



</div>
</body>
</html>

No comments:

Post a Comment