Starting an HTML ordered list with a number other than 1

Posted in HTML and CSS -

Last week I looked at how to use letters and roman numerals instead of numbers in an HTML ordered list and in this week's HTML post look at how the numbering can be started from a number other than the default 1.


Let's say we want to start our numbering from 5:

  1. This is number 5
  2. This is number 6
  3. This is number 7

I'm not sure why you would want to, but it's also possible to start from a negative number:

  1. This is negative 3
  2. This is negative 2
  3. This is negative 1

You can also combine the number to start from with a different type and start from e.g Roman 4 = iv:

  1. This is Roman number 4
  2. This is Roman number 5
  3. This is Roman number 6

Note that when using non Arabic numbers (Arabic numbers are normal numbers 1, 2, 3 etc) if the number is < 1 then it will show the Arabic number i.e. it would number -3 -2 -1 0 i ii iii iv etc for Roman.


Setting the start="X" attribute is all that is required to start numbering from a different number where X is the number to start from. Here's the HTML for each of the above examples:

 <ol start="5">
    <li>This is number 5</li>
    <li>This is number 6</li>
    <li>This is number 7</li>
<ol start="-3">
    <li>This is negative 3</li>
    <li>This is negative 2</li>
    <li>This is negative 1</li>
<ol type="i" start="4">
    <li>This is Roman number 4</li>
    <li>This is Roman number 5</li>
    <li>This is Roman number 6</li>

Related posts: