我创建了一个无序列表。我觉得无序列表中的项目符号很烦人,所以我想删除它们。

有可能有一个没有项目符号的列表吗?


当前回答

 <div class="custom-control custom-checkbox left">
    <ul class="list-unstyled">
        <li>
         <label class="btn btn-secondary text-left" style="width:100%;text-align:left;padding:2px;">
           <input type="checkbox" style="zoom:1.7;vertical-align:bottom;" asp-for="@Model[i].IsChecked" class="custom-control-input" /> @Model[i].Title
         </label>
        </li>
     </ul>
</div>

其他回答

我在ul和li上都使用了列表样式来删除子弹。我想用自定义字符替换项目符号,在本例中为“破折号”。这提供了一个很好的缩进效果,当文本换行时效果很好。

ul.dashed列表{列表样式:无外无;}ul.dashed-list li:之前{内容:“\2014”;浮动:左侧;边距:0 0-27px;填充:0;}ul.dashed列表li{列表样式类型:无;}<ul class=“虚线列表”><li>文本</li><li>文本</li></ul>

要完全删除ul默认样式:

    list-style-type: none;

    margin: 0;
    margin-block-start: 0;
    margin-block-end: 0;
    margin-inline-start: 0;
    margin-inline-end: 0;
    padding-inline-start: 0;

对前面的答案进行了小的改进:如果较长的行溢出到其他屏幕行,则使其更可读:

ul, li {list-style-type: none;}

li {padding-left: 2em; text-indent: -2em;}

如果您使用Bootstrap,它有一个“未样式”类:

删除列表项的默认列表样式和左填充(仅限直接子项)。

引导2:

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

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

引导3和4:

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

引导3:http://getbootstrap.com/css/#type-列表

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

引导5:https://getbootstrap.com/docs/5.0/content/typography/#unstyled

 <div class="custom-control custom-checkbox left">
    <ul class="list-unstyled">
        <li>
         <label class="btn btn-secondary text-left" style="width:100%;text-align:left;padding:2px;">
           <input type="checkbox" style="zoom:1.7;vertical-align:bottom;" asp-for="@Model[i].IsChecked" class="custom-control-input" /> @Model[i].Title
         </label>
        </li>
     </ul>
</div>