Forum Moderators: not2easy
Here is the relevant coding:
<div id="header">
<div id="sidebar">
Sidebar content
</div>
<div id="container">
</div>
<div id="content">
Main content.
</div>
</div>
And the relevant CSS:
#header
{
background: url('url') no-repeat scroll top left;
width:700px;
margin: 0;
padding: 0;
border: 1px solid red;
}
#content
{width: 500px;
border: 1px solid yellow;
margin: 0 0 0 25px;
}
#container {
width:525px;
height: 375px;
margin:0 0 0 0;
border: 1px solid green;
}
#sidebar {
float: right;
width: 150px;
text-align: left;
margin: 3px 0px 3px 30px;
padding: 6px 0px 10px 0px;
border: 1px solid blue;
}
I am very, very new to CSS and HTML, so the answer will probably be quite obvious to anyone who knows more than I do. I've tried searching for an answer on google and briefly scanned these forums, but I haven't found anything that helps me. I don't want to blame my incompetence on a browser, but so far, it seems as if this is a bug in IE.
Any help at all would be greatly appreciated. Thanks in advance.
Just a quick response that may be part of the problem. The actual width of an element is its width + margins + padding, the latter being one most do not realize. It is probable that your elements actually add up wider than the space allotted.
The other variable are the default margin and padding settings of browsers when you do not specify them. This variable can be anywhere from 5px - 10px, so the past thing to do is zero out these settings then assign your own. I suggest adding, for starters:
body {
margin: 0;
padding: 0;
}
to your CSS.
Marshall
[edited by: Marshall at 4:19 am (utc) on Aug. 19, 2008]
There has to be horizontal room for any objects next to floated divs or they are going to be forced down onto the next line.
Ryan