Forum Moderators: not2easy
Doctype given is: XHTML 1.0 Transitional
I gave the DIV's 'input field' and 'mission' both a value of 50%. However when you view this in IE7 (sorry I made a mistake in the title; the rendering engine is IE7), the 'mission' DIV 'wraps' under the 'inputfields' DIV (on a 'new line').
I want the 'input field' and 'mission' DIV's to stay next to each other and aligned (they are two adjacent boxes for page content and each should be half as big as the containing DIV 'planner-area').
I could 'fix' this by making one of the two 49%, but then there is a 'margin' (or padding?) at the right of the 'mission' DIV as you can see by the green (teal) background of the 'planner-area' DIV showing through.
Below is the code, I did read the rules but I think this is pretty short and I deleted the unnecessary values (font, color etc.)
How can I fix this and what is the explanation for this behavior?
Darkelve
CSS code:
#container {
margin-left: 22px;
margin-right: 22px;
background-color: yellow;}
#header-area {
background: maroon;
height: 90px /* temporary'placeholder' value */ ;
}
#planner-area {
float: left;
width: 100%;
clear: both;
background: teal;
}
#inputfields {
float: left;
width: 50%;
}
#banner-and-text
{
background: red;
}
#mission {
float: left;
width: 50%;
background: blue;
}
#three-cols-area {
background: olive;
}
HTML code:
<div id="container">
Container
<div id="header-area">
Header Area
</div> <div id="planner-area">
<div id="inputfields">
<div id="banner-and-text">Input Fields</div>
</div>
<div id="mission">
Mission
</div>
</div>
<div id="three-cols-area">
3 Columns Area
</div>
</div>
[edited by: Darkelve at 11:02 am (utc) on June 2, 2008]
So what's the solution:
only float one of them, let the other sit next to it and occupy the remaining space, then it doesn't matter all that much how many pixels the math if off.
Go with the flow. ;-)
Edit: well, I played around some more and I found a solution like what you are suggesting, but it only works when I give an explicit height to the DIVs.
[edited by: Darkelve at 12:24 pm (utc) on June 2, 2008]