How do I set vertical space between list items?

后端 未结 9 1130
暖寄归人
暖寄归人 2020-12-24 04:11

Within a

    element, clearly the vertical spacing between lines can be formatted with the line-height attribute.

    My question is, within a

相关标签:
9条回答
  • 2020-12-24 04:53

    To apply to an entire list, use

    ul.space_list li { margin-bottom: 1em; }
    

    Then, in the html:

    <ul class=space_list>
    <li>A</li>
    <li>B</li>
    </ul>
    
    0 讨论(0)
  • 2020-12-24 04:55

    You can use margin. See the example:

    http://jsfiddle.net/LthgY/

    li{
      margin: 10px 0;
    }
    
    0 讨论(0)
  • 2020-12-24 04:56

    I would be inclined to this which has the virtue of IE8 support.

    li{
        margin-top: 10px;
        border:1px solid grey;
    }
    
    li:first-child {
        margin-top:0;
    }
    

    JSFiddle

    0 讨论(0)
提交回复
热议问题