Home » CSS » list-style-type Number Example in CSS

list-style-type Number Example in CSS

The list-style-type property in CSS is used to specify the type of marker to use in a list. The decimal value is one option that can be used with this property, and it causes each list item to be marked with a number.

List Style Type Number Example in CSS

Here is an example of how to use the list-style-type: decimal property in a CSS rule:

ul {
  list-style-type: decimal;

This rule would apply to all unordered lists on the page, and it would cause each list item to be marked with a number, starting at 1 and incrementing by 1 for each subsequent list item. For example, the list items in the following unordered list would be marked with numbers:

  <li>List item 1</li>
  <li>List item 2</li>
  <li>List item 3</li>

The output would look something like this:

  1. List item 1
  2. List item 2
  3. List item 3

Note that the list-style-type property can be used with ordered lists (<ol>) as well as unordered lists (<ul>). In the case of ordered lists, the list-style-type property determines the type of number used to mark each list item (e.g. Arabic numerals, roman numerals, etc.).