I have this javascript code:
$(document).ready(function() {
var leftHeight = $('#maincontent').height();
$('#sidemenu').css({'height':leftHeight});
});
This works, but it is very limited. If my #sidemenu, is getting expanded (Example because of sub-menu), it become bigger inside the div.
How can I do so whenever #sidemenu or #maincontent for that matter, get’s bigger (height increases), they follow each other.
If this can be done with CSS, I am open for this too.
Regards.
Forget javascript.
Put
#sidemenuinto#maincontent, give it a fixed width and float it left. Then wrap everything in#maincontent(but not the#sidebar) into a div called#wrapper(lets say). Give#wrappera width which equals the width of#maincontentminus the width of#sidemenuand float it left too. For good measure just before the closing</div>of#maincontentput<br style="clear: both" />.Now
#maincontentwill expand to fit the sidemenu (if it needs to), but the content in#maincontentwill also not wrap underneath the#sidemenuif its too short, as its in a wrapper div of its own.Hope this helped.
update
here is an example:
html
css