Numbering ordered lists: Difference between revisions

No edit summary
No edit summary
Line 1: Line 1:
To number nested ordered lists , you can add the following CSS to the page ''MediaWiki:Common.css''.<syntaxhighlight lang="text">
/*Numbering nested ordered lists */
.mw-content-ltr ol, .ve-ce-branchNode ol{ counter-reset: item; margin-left:1.5em }
.mw-content-ltr ol li { display: block }
.mw-content-ltr ol li:before, .ve-ce-branchNode ol li:before { content: counters(item, ".") "."; counter-increment: item; margin-right:0.5em  }
.ve-ce-branchNode ol li p { display: inline}
</syntaxhighlight>


Output:
To create numbering as 1., 1.1, 1.1.1 and so on, use the following style:<syntaxhighlight lang="text">
 
# Step 1
## Substep 1
## Substep 2
### Sub-substep 1
 
 
Alternatively, to create numbering as 1., 1.1, 1.1.1 and so on use the following style:<syntaxhighlight lang="text">
article ol {  
article ol {  
counter-reset:section; list-style-type:none;  
counter-reset:section;  
list-style-type:none;  
}
}
article ol li {  
article ol li {  
Line 30: Line 16:
article ol li:before{
article ol li:before{
     counter-increment:section;
     counter-increment:section;
     content:counter(section) ". ";/*content:"Section " counter(section) ". ";*/
     content:counter(section) ". ";
     float: left;
     float: left;
     margin-right: 0.4em;
     margin-right: 0.4em;
Line 42: Line 28:
     content:counter(section) "." counter(subsection) "." counter(subsubsection) "" ;
     content:counter(section) "." counter(subsection) "." counter(subsubsection) "" ;
}
}
</syntaxhighlight>
/*Count footnotes separately*/
article ol.references {
counter-reset:ref; list-style-type:none;
}
article ol.references li:before{
    counter-increment:ref;
    content:counter(ref) ". ";
    float: left;
    margin-right: 0.4em;
}
</syntaxhighlight>Output:
 
# Step 1
## Substep 1
## Substep 2
### Subsubstep 1
# Step 2
 
[[Category:Customization]]
[[Category:Customization]]
[[en:{{FULLPAGENAME}}]]
[[en:{{FULLPAGENAME}}]]
[[de:Aufzählungslisten_nummerieren]]
[[de:Aufzählungslisten_nummerieren]]

Revision as of 17:39, 10 January 2023

To create numbering as 1., 1.1, 1.1.1 and so on, use the following style:

article ol { 
	counter-reset:section; 
	list-style-type:none; 
	}
article ol li { 
	list-style-type:none; 
	}
article ol li ol { 
	counter-reset:subsection; 
	}
article ol li ol li ol{ 
	counter-reset:subsubsection; 
	}	
article ol li:before{
    counter-increment:section;
    content:counter(section) ". ";
    float: left;
    margin-right: 0.4em;
	}
article ol li ol li:before {
    counter-increment:subsection;
    content:counter(section) "." counter(subsection) " ";
	}
article ol li ol li ol li:before {
    counter-increment:subsubsection;
    content:counter(section) "." counter(subsection) "." counter(subsubsection) "" ;
	}
/*Count footnotes separately*/	
article ol.references { 
	counter-reset:ref; list-style-type:none; 
	}
article ol.references li:before{
    counter-increment:ref;
    content:counter(ref) ". ";
    float: left;
    margin-right: 0.4em;
	}

Output:

  1. Step 1
    1. Substep 1
    2. Substep 2
      1. Subsubstep 1
  2. Step 2



To submit feedback about this documentation, visit our community forum.

Discussions