Numbering ordered lists: Difference between revisions

No edit summary
No edit summary
Line 5: Line 5:
/* First, set all numbered lists to use counter-reset */
/* First, set all numbered lists to use counter-reset */
.pdfcreator-page-content ol,
.pdfcreator-page-content ol,
#mw-content-text ol,
.mw-body-content ol,
ol.ve-ce-branchNode {
ol.ve-ce-branchNode {
     counter-reset: item;
     counter-reset: item;
Line 13: Line 13:
/* Display all list items in a numbered list in block display */
/* Display all list items in a numbered list in block display */
.pdfcreator-page-content ol > li,
.pdfcreator-page-content ol > li,
#mw-content-text ol > li,
.mw-body-content ol > li,
ol.ve-ce-branchNode > li {
ol.ve-ce-branchNode > li {
     display: block;
     display: block;
Line 23: Line 23:
/* Use a counter that checks the number of items and adds a "." between them and ends with ". " */
/* Use a counter that checks the number of items and adds a "." between them and ends with ". " */
.pdfcreator-page-content ol > li:before,
.pdfcreator-page-content ol > li:before,
#mw-content-text ol > li:before,
.mw-body-content ol > li:before,
ol.ve-ce-branchNode > li:before {
ol.ve-ce-branchNode > li:before {
     content: counters(item, ".") ". ";
     content: counters(item, ".") ". ";
Line 29: Line 29:
}
}


/*Number footnotes separately */
/*Number footnotes separately*/
.pdfcreator-page-content .references ::marker,
.pdfcreator-page-content .references::marker,
#mw-content-text .references ::marker {
.mw-body-content .references::marker {
     content: " ";
     content: " ";
}
}
.pdfcreator-page-content ol.references,
.pdfcreator-page-content ol.references,
#mw-content-text ol.references {
.mw-body-content ol.references {
     counter-reset: ref;
     counter-reset: ref;
     list-style-type: none;
     list-style-type: none;
}
}
.pdfcreator-page-content ol.references li:before,
.pdfcreator-page-content ol.references li:before,
#mw-content-text ol.references li:before {
.mw-body-content ol.references li:before {
     counter-increment: ref;
     counter-increment: ref;
     content: counter(ref) ". ";
     content: counter(ref) ". ";
    float: left;
     margin-right: 0;
     margin-right: 1em;
}
.pdfcreator-page-content ol > li li,
#mw-content-text ol > li li {
    margin-left: -0.3em;
}
}
</syntaxhighlight>Output:
</syntaxhighlight>Output:

Revision as of 09:31, 28 July 2026

To number bullets in the page text consecutively, you can add the following CSS to the page MediaWiki:Common.css. Please note that this custom styling may not work if it is incompatible with CSS declarations from other stylesheets in the wiki.

Example for separately numbered footnotes.[1] [2]

/* Styles for formatting sub-ordered-list-items with 1.1., 1.1.1., etc.)*/
/* First, set all numbered lists to use counter-reset */
.pdfcreator-page-content ol,
.mw-body-content ol,
ol.ve-ce-branchNode {
    counter-reset: item;
    margin: 0.3em 0 0 2.2em;
}

/* Display all list items in a numbered list in block display */
.pdfcreator-page-content ol > li,
.mw-body-content ol > li,
ol.ve-ce-branchNode > li {
    display: block;
}
ol.ve-ce-branchNode > li > p {
    display: inline
}

/* Use a counter that checks the number of items and adds a "." between them and ends with ". " */
.pdfcreator-page-content ol > li:before,
.mw-body-content ol > li:before,
ol.ve-ce-branchNode > li:before {
    content: counters(item, ".") ". ";
    counter-increment: item;
}

/*Number footnotes separately*/
.pdfcreator-page-content .references::marker,
.mw-body-content .references::marker {
    content: " ";
}
.pdfcreator-page-content ol.references,
.mw-body-content ol.references {
    counter-reset: ref;
    list-style-type: none;
}
.pdfcreator-page-content ol.references li:before,
.mw-body-content ol.references li:before {
    counter-increment: ref;
    content: counter(ref) ". ";
    margin-right: 0;
}

Output:

  1. Step 1
    1. Substep 1
    2. Substep 2
      1. SubSubstep 1
      2. SubSubstep 2
      3. SubSubstep 3
  2. Step 2
  3. Step 2
  4. Step 2

Bulleted lists that are not numbered are not affected by the CSS declarations:

  • List item
    • List item level 2
      • List item level 3

Numbering in a new "ordered list" starts back at 1:

  1. Step 1
    1. Substep 1
    2. Substep 2
      1. SubSubstep 1
      2. SubSubstep 2
      3. SubSubstep 3
  2. Step 2
  3. Step 2
  4. Step 2

Example for footnote numbering

These footnotes are formatted separately, although they are also just ordered list in the page content.

  1. Footnote 1
  2. Footnote 2


PDF exclude - start

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

PDF exclude - end