Click to See Complete Forum and Search --> : Nested div


bingecoder
10-08-2007, 01:21 PM
I have been trying without luck to fit two divs side by side inside another. The right one keeps falling below the left one though not directly. I can't figure out what I have done wrong, but certainly nothing is OK. Anyone out there ?

<div>
<leftdiv>
<div>
<rightdiv>
</div>
</div>

ray326
10-08-2007, 01:24 PM
<div style="width:30%;float:left">first div</div>
<div style="width:30%;float:left">next div</div>

I.e. width and float is the key.

bingecoder
10-08-2007, 01:40 PM
I want to size by actual width. Total width is 1000. Left box is 200 and right is 780 .

tgormtx
10-08-2007, 01:46 PM
<div style="width:1000px;">
<div style="float:left;width:200px;">Left Div Tag</div>
<div style="float:left;width:780px;">Right Div Tag</div>
</div>


Ray is right: Float and width are key. You might also need to check out browser compatibility. Do a Google search on the Box Model Hack if you start having issues with cross browser issues.

bingecoder
10-08-2007, 04:04 PM
Thanks , it is sorted . I missed out one div and that was the problem