Simulating border-collapse in lists (no tables)

前端 未结 7 1163
星月不相逢
星月不相逢 2020-12-08 19:09

I have always the same problem, when I have 2 adjacent elements with borders, the borders are merged. With tables we have the border-collapse property for solving this.

相关标签:
7条回答
  • 2020-12-08 19:50

    You can add a left and bottom border to the ul and drop it from the li.

    fiddle: http://jsfiddle.net/TELK7/

    html:

    <ul>
        <li>one</li>
        <li>two</li>
    </ul>
    

    css:

    ul{
        border: 0 solid silver;
        border-width: 0 0 1px 1px;
    }
    li{
        border: 0 solid silver;
        border-width: 1px 1px 0 0;
        padding:.5em;
    }
    
    0 讨论(0)
提交回复
热议问题