Dysan Posted January 20, 2008 Share Posted January 20, 2008 Hi, Using the following HTML & CSS code, is it possible to vertically and horizontally align the container div? HTML <!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"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="index.css" /> </head> <body> <div id="container"> </div> </body> </html> CSS * { FONT-SIZE: 8pt; FONT-FAMILY: Verdana; } body { MARGIN: 0px auto; BACKGROUND: url(BG.bmp) no-repeat; } #container { WIDTH: 733px; BORDER: 1px solid rgb(0,0,0); } Link to comment https://forums.phpfreaks.com/topic/86936-centred-div/ Share on other sites More sharing options...
dbrimlow Posted January 20, 2008 Share Posted January 20, 2008 change the body margin to 0 and make the container margin "margin:0 auto". Why are you using xhtml strict? Link to comment https://forums.phpfreaks.com/topic/86936-centred-div/#findComment-444482 Share on other sites More sharing options...
Dysan Posted January 20, 2008 Author Share Posted January 20, 2008 Why not? Link to comment https://forums.phpfreaks.com/topic/86936-centred-div/#findComment-444517 Share on other sites More sharing options...
bronzemonkey Posted January 20, 2008 Share Posted January 20, 2008 Why not? If you're asking that, you probably shouldn't be using it Link to comment https://forums.phpfreaks.com/topic/86936-centred-div/#findComment-444565 Share on other sites More sharing options...
Dysan Posted January 20, 2008 Author Share Posted January 20, 2008 I mean, why shouldn't I use it. Whats wrong with it? Link to comment https://forums.phpfreaks.com/topic/86936-centred-div/#findComment-444570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.