Click to See Complete Forum and Search --> : PLZ help with positioning...


problema
12-31-2006, 10:04 PM
Ok, I understand that this issue has been overwhelmingly covered already, but I have been browsing the forum for hours now and just can't seem to fix my problem.

Thing is, I centered a div (container) and the high-child div (banner) works fine, but the to bottom ones (left and right) keep floating away from the parent-div's width.

I am really new to all this and any help would be fully apreciated.

The .css file:
body {
cursor:default;
margin: 0;
text-align: center;
}

#container {

position: relative;
width: 810px;
margin: 0 auto;
border-spacing: 0px 0px;
right: auto;
left: auto;
clear: left;
padding: 0;
}

#banner {
width: 800px;
height: 310px;
margin: 0;
border-color: #999999;
color: #ffffff;
font: 8pt 'Lucida Grande', LucidaGrande, Lucida, Helvetica, Arial, sans-serif;
padding-top: 0px;
padding-bottom: 0px;
text-align: left;
}

#left {
width: 400px;
margin: 0;
padding: 0;
float: left;
}

#right {
margin: 0;
padding: 0 0 0 0px;
border-left: dashed #666666 2px;
float: right;
width: 200px;
}

The html code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>:eveRlasT .//</title>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">

<link href="stylish.css" rel="stylesheet" title="stylish.css" type="text/css" />

</head>

<body>
<div class="container">

<div class="banner"><img src="interface/banners/random.php"></div>

<div id="left">lteste</div>

<div id="right">rteste</div>

</div>

</body>
</html>

I know it's pretty clean right now, and I hope it helps you help me! ...

bathurst_guy
12-31-2006, 10:17 PM
first, class is referenced in the stylesheet as . (period) and id as # (hash)
therefore change your stylesheet (or html) to reflect this. ie:
<div id="container"> is referenced in the CSS as #container
<div class="container"> is referenced in the CSS as .container

ray326
12-31-2006, 10:24 PM
Well the first two divs should have ids, not classes.

problema
12-31-2006, 10:39 PM
Holy crap! That was effective. :)

Geez, I'ma have some trouble til I actually learn this thing...

Well, thanks a lot, I am very thankful for your help (though it made me look stupid :p ) and I shall now proceed to further headaches.

PS: it is comforting to know that I can get real help online, I'll try not to post stupid questions in the future...

bathurst_guy
12-31-2006, 10:46 PM
No problem. While we are on the issue of 'id vs class' maybe you would like to know the differences between them and why you would use one over the other.
http://www.w3.org/TR/html401/struct/global.html#adef-class
http://www.webdeveloper.com/forum/showthread.php?t=109986
http://www.webdeveloper.com/forum/showthread.php?t=85247