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

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


当前回答

如果您使用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

其他回答

如果您想在不使用CSS的情况下保持简单,我只需要;在我的代码行中。即<table></table>。

是的,它会留下一些空间,但这不是坏事。

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

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

这将垂直排列一个没有项目符号的列表。只有一行!

li {
    display: block;
}

如果您想仅使用纯HTML实现这一点,此解决方案将适用于所有主要浏览器:

描述列表

只需使用以下HTML:

<dl><dt>列出项目1</dt><dd>子项1.1</dd><dt>列出项目2</dt>子项2.1</dd>子项2.2</dd>子项2.3</dd><dt>列出项目3</dt><dd>子项3.1</dd></dl>

此处示例:https://jsfiddle.net/zumcmvma/2/

此处参考:https://www.w3schools.com/tags/tag_dl.asp