View Full Version : Major dilemma

Jan 25th, 2009, 05:14 PM
I am trying to build my web page so its centered on the screen like this site (http://www.dumblaws.com) and i dont want the website to take up the whole screen like this site (http://en.wikipedia.org/wiki/Main_Page)

I know its probably done using divs but how?

Jan 25th, 2009, 05:27 PM
Hello blackwolf,
Take a wrapper div, give it a width and put margin:0 auto; on it to center. Like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html, body {
font: 12px "Comic Sans MS";
background: #FC6;
text-align: center;
* {
margin: 0;
padding: 0;
border: none;
#wrap {
width: 800px;
margin: 30px auto; /*this is the bit that centers it*/
background: #999;
<div id="wrap">
Some website goes in this centered div.
<!--end wrap--></div>