Set a DIV height equal with of another DIV

后端 未结 7 2403
终归单人心
终归单人心 2020-12-08 11:06

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

相关标签:
7条回答
  • 2020-12-08 11:49

    The reason your first example isn't working is because of a typo:

    $(".sidebar").css({'height':($(".content").height()+'px'});
    

    should actually be

    $(".sidebar").css({'height':($(".content").height()+'px')});
    

    you're missing a trailing bracket from before the .content selector.

    0 讨论(0)
提交回复
热议问题