开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜