Unordered List with numbers instead of bullet points

6k views Asked by At

I have a Terms and Conditions file that I need to get on the webiste. However there are a lot of clauses and points such as 2, 2.1, 2.1.1 etc.

I thought I could do an unordered list and use css to get rid of the bullet points. I realize it may seem a bit long-winded but I am no HTML expert and I am also not sure how to go about it.

4

There are 4 answers

3
Mike On BEST ANSWER

Try using 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>

This will produce:

  1. test
  2. test

    2.1. testing

    2.2. testing

Read more here: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Counters

0
stackoverfloweth On

have you tried an ordered list?

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

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

0
Gravinco On

You can use CSS to change/remove the bullets but if you want to use numbers you will have to use an Ordered List.

To remove the bullets just use this line in CSS:

list-style-type:none
0
Fadi Obaji On

You can use ol

Like this:

<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> 

Output:

enter image description here

Hope that helps :)