用数字代替项目符号点的无序列表

Unordered List with numbers instead of bullet points

我有一个条款和条件文件,我需要在网站上获取。但是2、2.1、2.1.1等条款和要点很多

我想我可以做一个无序列表并使用 css 来去掉要点。我意识到这似乎有点啰嗦,但我不是 HTML 专家,我也不确定如何去做。

您尝试过有序列表吗?

<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

http://www.w3schools.com/tags/tag_ol.asp

您可以使用 CSS 到 change/remove 项目符号,但如果您想使用数字,则必须使用有序列表。

要删除项目符号,只需使用 CSS 中的这一行:

list-style-type:none

您可以使用ol

像这样:

<ol>
  <li>Hello 
   <ol>
    <li>Hello 1</li>
    <li>Hello 2</li>
    <li>Hello 3</li>
   </ol>
  </li>
  <li>hi</li>
  <li>hey</li>
</ol> 

输出:

希望对您有所帮助:)

尝试使用 counters

ol {
  counter-reset: item;
}
li {
  display: block;
}
li:before {
  content: counters(item, ".")". ";
  counter-increment: item;
}
<ol>
  <li>test</li>
  <li>test</li>
  <ol>
    <li>testing</li>
    <li>testing</li>
  </ol>
</ol>

这将产生:

  1. test
  2. test

    2.1. testing

    2.2. testing

在此处阅读更多内容:https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Counters