I want a two-column div layout, where each one can have variable width e.g.
div {
float: left;
}
.second {
background: #ccc;
}
<div>Tree</div>
<div class="second">View</div>
I want the 'view' div to expand to the whole width available after 'tree' div has filled needed space. Currently my 'view' div is resized to content it contains It will also be good if both divs take up whole height
Not duplicate disclaimer:
Expand div to max width when float:left is set because there the left one has a fixed width.
Help with div - make div fit the remaining width because I need two columns both aligned to left
Flexbox solution
Note: Add flex vendor prefixes if required by your supported browsers.
This would be a good example of something that's trivial to do with tables and hard (if not impossible, at least in a cross-browser sense) to do with CSS.
If both the columns were fixed width, this would be easy.
If one of the columns was fixed width, this would be slightly harder but entirely doable.
With both columns variable width, IMHO you need to just use a two-column table.
You can try CSS Grid Layout.
Im not sure if this is the answer you are expecting but, why don't you set the width of Tree to 'auto' and width of 'View' to 100% ?
Check this solution out
You can use W3's CSS library that contains a class called
rest
that does just that:Don't forget to link the CSS library in the page's
header
:Here's the official demo: W3 School Tryit Editor