List items with same height

后端 未结 8 1300
谎友^
谎友^ 2020-12-18 23:36

I have created a fiddle: http://jsfiddle.net/pQZ8f/

I want to have both the list items to be of same height without setting height manually. I want it to auto grow.

8条回答
  •  忘掉有多难
    2020-12-19 00:13

    It's 2018, and we have display: flex, with 97.66% browser support (https://caniuse.com/#feat=flexbox)

    With flexbox, all you need to do is:

    ul {
      display: flex;
    }
    
    li{
     width:100px;
     border: 1px solid black;   
    }
    

    Here's the fiddle: http://jsfiddle.net/pQZ8f/1076/

提交回复
热议问题