How can we change the style of numbering in an ordered list?

How to Change Numbering Styles for Ordered Lists

Ordered lists (<ol>) are usually numbered in XHTML output using numerals. If you want to change the numbering to alphabetical, follow these steps:
  1. Define a custom @outputclass value and set it as an attribute of the ordered list, as in the following example:<ol outputclass="number-alpha"> <li>A</li> <li>B</li> <li>C</li> </ol>
  2. Add the following code snippet in a custom CSS file:ol.number-alpha{ list-style-type:lower-alpha; }
  3. Reference the CSS file in a WebHelp Responsive transformation using an Oxygen Publishing Template or the args.css parameter.

<ol>: The Ordered List element

The <ol> HTML element represents an ordered list of items — typically rendered as a numbered list.

Content categoriesFlow content, and if the <ol> element's children include at least one <li> element, palpable content.
Permitted contentZero or more <li>, <script> and <template> elements.
Tag omissionNone, both the starting and ending tag are mandatory.
Permitted parentsAny element that accepts flow content.
Implicit ARIA rolelist
Permitted ARIA rolesdirectory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree
DOM interfaceHTMLOListElement

HTML Ordered Lists

❮ Previous Next ❯

The HTML <ol> tag defines an ordered list. An ordered list can be numerical or alphabetical.


The markup

  1. This is the first item
  2. This is the second item
  3. This is the third item
  4. This is the fourth item
  5. This is the fifth item
  6. This is the sixth item

The first thing we need to define is where the counter should be reset

.custom-counter { counter-reset: section; }

Now, the counter will start from 0. The value of the couter-reset property can be anything you want, it will be used for the counter-increment property later.

Next, we need to add the CSS to auto increment the number of items

.custom-counter li::before { counter-increment: step-counter; content: counter(step-counter); }

In this code, we are telling the CSS to start incrementing for all li elements inside .custom-couter. The first li element will be numbered 1, the second will be numbered 2 and so on.

We also use content property to show the number with the value counter(step-counter).

And this is the final result

How can we change the style of numbering in an ordered list?
  • Some notices:
    • You can apply numbered counters with any html tag you want, it isn’t limited to ordered list
    • The number don’t have to be decimals, they can be anything that list-style-type property can be
disc (• • •) circle (○ ○ ○) square (▪ ▪ ▪) decimal (1 2 3) decimal-leading-zero (01, 02, 03) lower-roman (i ii iii) upper-roman (I II III) lower-greek (α β γ) lower-latin (a b c) upper-latin (A B C) armenian (Ա Բ Գ) georgian (ა ბ გ) lower-alpha (a b c) upper-alpha (A B C)

Start with 1.

If you want to change any number in a list to 1, here’s how:

  1. Double-click the numbers in the list. The text will not appear selected.

    How can we change the style of numbering in an ordered list?

  2. Right-click the number you want to start a new list.

  3. Click Restart at 1.

More about lists

Change bullet indents

Top of Page