I have two side-by-side DIVs in a JSP. It works well, with one exception: I can't get the jQuery Dynatree to fill the lefthand DIV's horizontal space properly:
Here's the HTML:
<div id="sub-title">
<div id="sub-left">
<fieldset class="search-fields">
<legend>Files Found</legend>
<!-- Add a <div> element where the tree should appear: -->
<div id="tree">
</div>
</fieldset>
</div>
<div id="sub-right">
<fieldset class="search-fields">
<legend id="selectedFileLegend">Selected File Contents</legend>
<textarea name="fileContents" id="fileContents" rows="20" readonly="readonly" wrap='off'>
(select via tree on left)
</textarea>
</fieldset>
</div>
<div class="clear-both"></div>
</div>
and CSS:
#sub-left {
/* background: #99FF99; pale green */
/* border:1px dashed; */
float: left;
width: 24%;
}
#sub-right {
/* background: #FFCC99; pale orange */
/* border:1px dashed; */
float: right;
width: 73%;
}
#sub-title {
overflow:hidden;
}
.clear-both {
clear: both;
}
#tree {
vertical-align: top;
width: 250px;
}
I of course also use the dynatree CSS. Any idea what's wrong? Thanks for the help!
Your #tree
width is set to 250px;
#tree {
vertical-align: top;
width: 250px;
}
If you set it to 100%
(or remove the width property altogether), it will fill its container (#sub-left
).
This is also the reason why it extends out of the #sub-left
container when you have shrunk the window (second image), as 250px becomes larger than 24% of the available size.