How to Start a List with a Number Other than 1 and Still Have it Automatically Numbered (HTML)

Count from a different number in an ordered list


How to Start a List with a Number Other than 1 and Still Have it Automatically Numbered (HTML)

by Christopher Heng, thesitewizard.com

One of my visitors wrote to ask how she could start a list with a number other than 1 (the default), without having to insert all the item numbers manually. That is, she wanted to use the automatic numbering facility provided by HTML, where each point in the list is given an incremental number even if you add new items into (or delete them from) the middle of the list, except that she didn't want to count from 1.

Preamble

This article provides the solution using HTML. To use it, you will need to be able to modify your HTML code directly. If you use a visual editor, switch to its Source or Code mode (or whatever that editor calls its raw HTML editing facility). See the following tutorials if you don't know how to do this:

The method also works if you have a blog. Switch to its HTML entry mode to insert the code described below. For example, if you use the Block editor in WordPress (the default in the current versions), click the "+" at the top of the Add Post screen, and in the overlay that appears, click "Formatting" to expand the section. Then click "Custom HTML". You will be able to enter your code directly, from that point.

How to Count from a Different Number in an Ordered List

Ordered lists (the technical name for a numbered list) are denoted by <ol> in HTML. Take the following as an example.

<ol>
<li>calling birds</li>
<li>golden rings</li>
<li>geese a-laying</li>
<li>swans a-swimming</li>
</ol>

Each item in the list is enclosed within <li> and </li> tags, where "li" probably stands for "list item", and the entire list is enclosed within <ol> and </ol>, where "ol" means "ordered list".

To start the list with some other number, say, "4", change the opening <ol> tag so that it now says <ol start="4">. You can of course use any number here. "4" is just an example.

The HTML for your list will now look like this:

<ol start="4">
<li>calling birds</li>
<li>golden rings</li>
<li>geese a-laying</li>
<li>swans a-swimming</li>
</ol>

And the output of the above code should appear as follows:

  1. calling birds
  2. golden rings
  3. geese a-laying
  4. swans a-swimming

Note that even if you use English letters or Roman numerals to number your lists, the start number should still be specified as an Arabic numeral. For example, if you want to start your list using the Roman number "viii" (ie, 8), you will have to say "<ol start="8">". The web browser will convert that 8 to whatever number system you have chosen for your list.

Compatibility

The start attribute is recognized by all browsers. Although the HTML 4.01 specifications state that the feature is deprecated, (ie, it is accepted but they intend to remove it in future versions of the language), HTML 5 has reversed this (ie, it is no longer marked for removal but will be retained).

Copyright © 2020 Christopher Heng. All rights reserved.
Get more free tips and articles like this, on web design, promotion, revenue and scripting, from https://www.thesitewizard.com/.

thesitewizard™ News Feed (RSS Site Feed)  Subscribe to thesitewizard.com newsfeed

Do you find this article useful? You can learn of new articles and scripts that are published on thesitewizard.com by subscribing to the RSS feed. Simply point your RSS feed reader or a browser that supports RSS feeds at https://www.thesitewizard.com/thesitewizard.xml. You can read more about how to subscribe to RSS site feeds from my RSS FAQ.

Please Do Not Reprint This Article

This article is copyrighted. Please do not reproduce or distribute this article in whole or part, in any form.

Related Articles

New Articles

How to Link to This Page

It will appear on your page as:

How to Start a List with a Number Other than 1 and Still Have it Automatically Numbered (HTML)





Home
Donate
Contact
Link to Us
No Spam Policy
Privacy Policy
Topics
Site Map

Getting Started
Web Design
Search Engines
Revenue Making
Domains
Web Hosting
Blogging
JavaScripts
PHP
Perl / CGI
HTML
CSS
.htaccess / Apache
Newsletters
General
Seasonal
Reviews
FAQs
Wizards

 

 
Free webmasters and programmers resources, scripts and tutorials
 
HowtoHaven.com: Free How-To Guides
 
Site Design Tips at thesitewizard.com
Find this site useful?
Please link to us.