View Full Version : Width Problem...

09-24-2009, 11:11 PM
I have a Div with the width of 98% and inside that i have one of 400px and another next to it with 100% ie: depending on the width of the screen the second div would be another 300 or 600px's wide until it fits the parent div of 98%

If a container (including the browser window itself) is not wide enough to accommodate both a float with a specified width and any content with a specified width that follows it, the content after the float will drop below the float rather than wrapping around it.
Affects: Internet Explorer 6.0, 7.0
Likelihood: Likely

I get this error and know how I could fix it but that would specify the width.


09-25-2009, 06:14 AM
if your second div is 100% of the parent div then how do you think you are going to squeeze an extra 400px into it? Do the maths and it will tell you that this isn't going to work.

09-25-2009, 06:28 AM
But my main div is 98% right
inside that i want two boxes side by side, one will be 400px the other will be the rest if the screen, depending on screen size that will change, what do i set that width to be?

09-25-2009, 07:03 AM
i would approach it diferently . like this perhaps,
<style type="text/css">
#wrap {
width:950px; margin-left:auto; margin-right:auto; float:left; border:#666 solid 1px;}

.first{ width: 100%; height:30px; position:relative; float:left; border:#666 solid 1px; background-color:#F00;}
.second{ width: 400px; height:30px; position:relative;float:left;border:#666 solid 1px;background-color: #00F}

<body >
<div id="wrap">

<div class="first"><div class="second"></div></div>