Sibling divs match height in container

后端 未结 4 1804
情话喂你
情话喂你 2020-12-14 17:24

I have three divs in a container: http://jsfiddle.net/fBe9y/

One div has a lot of content. How do I get the other two divs, with less content, to match

4条回答
  •  Happy的楠姐
    2020-12-14 18:18

    HTML

    1
    2
    3

    CSS

    #container {
      display: flex;
      align-items: stretch;
    }
    
    #div1 {
      display: flex;
    }
    
    #div2 {
      display: flex;
    }
    
    #div3 {
      display: flex;
    }
    

    this 'display: flex;' and 'align-items: stretch;' in the container should make all the children div same height, as long as it is of the desired height.

提交回复
热议问题