I need an unordered list without any bullets

后端 未结 14 1209
清酒与你
清酒与你 2020-11-22 07:16

I have created an unordered list. I feel the bullets in the unordered list are bothersome, so I want to remove them.

Is it possible to have a list without bullets?<

相关标签:
14条回答
  • 2020-11-22 08:09

    If you're using Bootstrap, it has an "unstyled" class:

    Remove the default list-style and left padding on list items (immediate children only).

    Bootstrap 2:

    <ul class="unstyled">
       <li>...</li>
    </ul>
    

    http://twitter.github.io/bootstrap/base-css.html#typography

    Bootstrap 3 and 4:

    <ul class="list-unstyled">
       <li>...</li>
    </ul>
    

    Bootstrap 3: http://getbootstrap.com/css/#type-lists

    Bootstrap 4: https://getbootstrap.com/docs/4.3/content/typography/#unstyled

    0 讨论(0)
  • 2020-11-22 08:09

    If you're unable to make it work at the <ul> level, you might need to place the list-style-type: none; at the <li> level:

    <ul>
        <li style="list-style-type: none;">Item 1</li>
        <li style="list-style-type: none;">Item 2</li>
    </ul>
    

    You can create a CSS class to avoid this repetition:

    <style>
    ul.no-bullets li
    {
        list-style-type: none;
    }
    </style>
    
    <ul class="no-bullets">
        <li>Item 1</li>
        <li>Item 2</li>
    </ul>
    

    When necessary, use !important:

    <style>
    ul.no-bullets li
    {
        list-style-type: none !important;
    }
    </style>
    
    0 讨论(0)
提交回复
热议问题