Topic on Help talk:Lists

How to write sub-numbered lists

2
Actiuinformatica (talkcontribs)
1. Fruits
 1.1. Banana
 1.2. Apple
 1.3. Orange
2. Vehicles
 2.1. Car
 2.2. Motorcycle
Dennis J au (talkcontribs)

This is an old question, but I have a suggestion on how you could implement what you have referred to as sub-numbered ordered lists.

If you can edit the wiki's .css you can achieve sub-numbered ordered lists by creating a style declaration for such lists, and then wrapping the ordered list wiki-markup in a div with the specified class. See contents of the table below.

The final example will not display properly until after you have made appropriate edits to the wiki's .css via, for example, the edit options available here: Your preferences: 'Appearance' section, under the Skin heading.

Of course, changes to your personal .css will only be reflected when you are logged in with the account of the person under which the changes were made. You would need greater access permissions to edit the site-wide .css in your site's Mediawiki:Commons.css file for everyone to be able to see the resulting sub-numbered lists.

css
.style-for-sub-numbered-lists ol {
  counter-reset: item
}
.style-for-sub-numbered-lists li {
  display: block
}
.style-for-sub-numbered-lists li:before {
  content: counters(item, ".") ". ";
  counter-increment: item;
}

wiki-markup
<div class="style-for-sub-numbered-lists">
# Fruits
## Banana
## Apple
## Orange
# Vehicles
## Car
## Motorcycle
</div>

Simulated rendering of wiki-markup.
   1. Fruits
        1.1. Banana
        1.2. Apple
        1.3. Orange
   2. Vehicles
        2.1. Car
        2.2. Motorcycle
Actual rendering of wiki-markup if you have edited the .css, for example through the links for changing your personal .css here: Your preferences: 'Appearance' section, under the Skin heading. If the css has not been changed, then the rendering will look like the classic mediawiki ordered list rendering, that is, with no sub-numbering.
  1. Fruits
    1. Banana
    2. Apple
    3. Orange
  2. Vehicles
    1. Car
    2. Motorcycle

Thanks to https://stackoverflow.com/a/10405962 'Html ordered list 1.1, 1.2 (Nested counters and scope) not working'

Reply to "How to write sub-numbered lists"