MediaWiki:Gadget-headings-number.css
来自存档计划,Project Archive by Lakejason0
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 Ctrl-F5。
/*
* Add anonymous replaced elements to auto-number sections
*
* (This feature was removed in MediaWiki 1.38 for "performance reasons",
* see https://www.mediawiki.org/wiki/MediaWiki_1.38#Other_changes )
*
* Note that MediaWiki does not have nested DOM elements for sections, so we
* cannot use nested counters and have to hack it with several counters per
* each level.
*
* Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Counter_Styles/Using_CSS_counters
*/
/* Create counters and set their initial value to 0. */
body {
counter-reset: h2-section h3-section h4-section h5-section h6-section;
}
/* Set up resetting */
/* (note that counter-reset does not work) */
h2 > .mw-headline
{
counter-increment: h2-section;
counter-set: h3-section h4-section h5-section h6-section;
}
h3 > .mw-headline
{
counter-increment: h3-section;
counter-set: h4-section h5-section h6-section;
}
h4 > .mw-headline
{
counter-increment: h4-section;
counter-set: h5-section h6-section;
}
h5 > .mw-headline
{
counter-increment: h5-section;
counter-set: h6-section;
}
h6 > .mw-headline
{
counter-increment: h6-section;
}
/* Display the counters in the headings */
h2 > .mw-headline::before
{
content: counter(h2-section);
}
h3 > .mw-headline::before
{
content: counter(h2-section) "." counter(h3-section);
}
h4 > .mw-headline::before
{
content: counter(h2-section) "." counter(h3-section) "." counter(h4-section);
}
h5 > .mw-headline::before
{
content: counter(h2-section) "." counter(h3-section) "." counter(h4-section) "." counter(h5-section);
}
h6 > .mw-headline::before
{
content: counter(h2-section) "." counter(h3-section) "." counter(h4-section) "." counter(h5-section) "." counter(h6-section);
}
h2 > .mw-headline::before,
h3 > .mw-headline::before,
h4 > .mw-headline::before,
h5 > .mw-headline::before,
h6 > .mw-headline::before
{
opacity: 0.6;
font-style: italic;
margin-right: 1ex;
}