How do I keep two side-by-side divs the same height?

后端 未结 22 2804
自闭症患者
自闭症患者 2020-11-21 07:56

I have two divs side by side. I\'d like the height of them to be the same, and stay the same if one of them resizes. I can\'t figure this one out though. Ideas?

To c

22条回答
  •  终归单人心
    2020-11-21 08:10

    Using jQuery

    Using jQuery, you can do it in a super simple one-line-script.

    // HTML
    
    // Javascript $("#columnTwo").height($("#columnOne").height());

    Using CSS

    This is a bit more interesting. The technique is called Faux Columns. More or less you don't actually set the actual height to be the same, but you rig up some graphical elements so they look the same height.

提交回复
热议问题