How to have elements copy other element's auto height css?
I have a right column on my page that has varying heights, set as height: auto;
I also have a left content section, that I want to mimic the height of my 开发者_如何学运维right column.
How can I do this using css, jquery, or some other code?
$(document).ready(function() {
var x = $('#primary').height();
$('#sidebar').css('height', x);
});
This jQuery snippet will take the height of #primary
and apply it to #sidebar
, syncing the height of both elements.
http://jsfiddle.net/pUXCE/4/ <-- working example.
精彩评论