I have two DIVs, .sidebar
and .content
and I want to set .sidebar
to keep the same height with the .content.
I\'ve tried the f
I used this technique to force the footer element to remain at the bottom of the page based on the height of another element. In your case you would; getting sidebar and content divs to keep the same height can do the following.
Get the height of the main div; I'm guessing that is the .content div; and assign it to a variable.
var setHeight = $(".content").height();
then you can use jQuery to get the sidebar and assign the content height using the variable.
$(".sidebar").height(setHeight);
It is as simple as that. The final code will look like this.
`var setHeight = $(".content").height();`
`$(".sidebar").height(setHeight);`
Here are more examples. Set div height using jquery (stretch div height).