css flexbox: same height for all elements?

前端 未结 4 861
慢半拍i
慢半拍i 2021-01-12 09:59

Using CSS and flexbox, I don\'t understand how to give the same height to divs \"a\" and \"b\". I need b to become taller so as to match a\'s height. In other words, the gre

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-12 10:26

    The trick is this part

    .xyz {
      width: 70%;
      box-shadow: 0 0 30px;
      text-align:center;
      -webkit-flex: 9 0 0; 
      flex: 9 0 0; 
    }
    

    http://codepen.io/damianocel/pen/XmxmQE

    Now these divs will have the same height, no matter the overall pages height.

    Is this what you have looked for?

提交回复
热议问题