List items with same height

后端 未结 8 1264
谎友^
谎友^ 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:29

    Ahh, yee old same height column problem.

    One solution is to fart around with bottom margin / padding.

    Works in IE7+ (might even work using ie6, I don't have it installed)

    ul {
        overflow: hidden;
        border: 1px solid black;
        float: left;
    }
    li {
        float:left;
        width:100px;
        background: red;
        padding-bottom: 10000px;
        margin-bottom: -10000px;
    }
    li + li {
        border-left: 1px solid black;
    }
    

    JSfiddle Demo

提交回复
热议问题