PDA

View Full Version : Will this do as vertical / horizontal css?


student101
06-18-2008, 08:47 AM
Believe me when I say google is a great tool, but sometimes you have to re-re-re-re-read some books to actually understand the lingo properly.

Will this do as a vertical / horizontal centre css idea that I have?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My centre vertical / horizontal css</title>
<style type="text/css">

body {
margin:0px 0px; padding:0px;
text-align:center;
}

#Content {
width:900px; /* Set your width here*/
text-align:left; /* Counteract to IE5/Win Hack */
padding:5px;
border:1px dashed #333;
background-color:#eee;
height: auto; /* Purely for expansion (up and down)*/
margin: 100px auto 100px auto
}
</style>
</head>

<body>
<div id="Content">
<p>Content Goes Here</p>
</div>
</body>
</html>It all works 100%, just looking for opinions and or ideas OR if you got something better?

Cheers

student101
06-18-2008, 09:24 AM
Quick update:
Auto expanding based on data in the div, add this to #Content {
overflow: hidden;Forgot that some users will complain later...

Cheers

edbr
06-18-2008, 09:38 AM
i would say it would depend if you want to add more, look at float and reative positioning and clear.

student101
06-18-2008, 10:07 PM
Will do, Thanks.