Template:Static row numbers/styles.css
Appearance
From Wikipedia, the free encyclopedia
/* {{pp-template}} */ /** * Add a static (unsortable) column of numbers to the left of a table. * Optionally disable numbers on specific rows for headers (no borders) or data * (borders). Optionally display column header text: "No." or hash ("#"). * * Classes: * - table.static-row-numbers * - table.static-row-header-text * - table.static-row-header-hash * - tr.static-row-header * - tr.static-row-numbers-norank * * Tested: * - Windows 10: (all skins) Chrome, Firefox, Edge. * - Android Galaxy S21 (MinervaNeue): Chrome, Firefox. * - Wikipedia Android app. * - Print. * - No JavaScript. * - Sticky gadget in Windows browsers (default skin). * - Dark Reader browser extention in Windows browsers (default skin). * * Notes: * - Sortable moves to thead any header rows and (after sort) sorttop rows. * - Sticky gadget (.mw-sticky-header) moves to thead any wikitable header rows. */ .static-row-numbers{ counter-reset:rowNumber; } .static-row-numberstr::before{ content:""; display:table-cell; padding-right:0.5em; padding-left:0.5em; text-align:right; vertical-align:inherit; } .static-row-numbers.static-row-numbers-lefttr::before{ text-align:left; } .static-row-numbers.static-row-numbers-centertr::before{ text-align:center; } .static-row-numbers.wikitabletr::before{ background-color:var(--background-color-neutral,#eaecf0); } body.skin-minerva.static-row-numbers.wikitabletr::before{ background-color:var(--background-color-neutral,#eaecf0); color:var(--color-base,#202122); } /** * Add count to all tbody rows except for two classes. If no thead, skip the * first tbody row which may not have one of the two classes: */ .static-row-numbersthead+tbodytr:first-child:not(.static-row-header):not(.static-row-numbers-norank)::before, .static-row-numberstbodytr:not(:first-child):not(.static-row-header):not(.static-row-numbers-norank)::before{ counter-increment:rowNumber; content:counter(rowNumber); } /** * Add column label to first row in thead or, if no thead, in tbody: */ .static-row-header-text.static-row-numberstheadtr:first-child::before, .static-row-header-text.static-row-numberscaption+tbodytr:first-child::before, .static-row-header-text.static-row-numberstbody:first-childtr:first-child::before{ content:"No."; font-weight:bold; } .static-row-header-hash.static-row-numberstheadtr:first-child::before, .static-row-header-hash.static-row-numberscaption+tbodytr:first-child::before, .static-row-header-hash.static-row-numberstbody:first-childtr:first-child::before{ content:"#"; font-weight:bold; } /** * Add borders in numbers column. * * Windows Firefox tr::before doesn't inherit color, so hard set. * Plain table borders on Timeless {{row hover highlight}} mw-datatable. */ /* Wikitable. */ .static-row-numbers.wikitabletr::before{ border:0solidvar(--border-color-base,#a2a9b1); } .static-row-numbers.wikitablethead+tbodytr:first-child:not(.static-row-header)::before, .static-row-numbers.wikitabletbodytr:not(:first-child):not(.static-row-header)::before{ border-width:1px; } body.skin-monobook.static-row-numbers.wikitabletr::before{ border-color:#aaaaaa; } body.skin-timeless.static-row-numbers.wikitabletr::before{ border-color:#c8ccd1; } body.skin-minerva.static-row-numbers.wikitabletr::before{ border-color:rgba(84,89,93,.3); } /* Plain with border. */ table[border].static-row-numbers:not(.wikitable)tr::before{ border:0inset#202122; } table[border].static-row-numbers:not(.wikitable)thead+tbodytr:first-child:not(.static-row-header)::before, table[border].static-row-numbers:not(.wikitable)tbodytr:not(:first-child):not(.static-row-header)::before{ border-width:1px; } body.skin-monobooktable[border].static-row-numbers:not(.wikitable)tr::before, body.skin-timelesstable[border].static-row-numbers:not(.wikitable):not(.mw-datatable)tr::before{ border-color:#000000; } /* Plain with optional border + .mw-datatable. */ body.skin-timeless.static-row-numbers.mw-datatable:not(.wikitable)tr::before{ border:0solid#c8ccd1; } body.skin-timeless.static-row-numbers.mw-datatable:not(.wikitable)thead+tbodytr:first-child:not(.static-row-header)::before, body.skin-timeless.static-row-numbers.mw-datatable:not(.wikitable)tbodytr:not(:first-child):not(.static-row-header)::before{ border-width:1px; } /* Minerva mobile. */ @mediaalland(max-width:720px){ /* Wikitable. */ body.skin-minerva.static-row-numbers.wikitabletr::before{ border-left-width:1px; } body.skin-minerva.static-row-numbers.wikitabletheadtr:first-child::before, body.skin-minerva.static-row-numbers.wikitablecaption+tbodytr:first-child::before, body.skin-minerva.static-row-numbers.wikitabletbody:first-childtr:first-child::before{ border-top-width:1px; } body.skin-minerva.static-row-numbers.wikitabletbodytr:last-child::before, body.skin-minerva.static-row-numbers.wikitabletfoottr:last-child::before{ border-bottom-width:1px; } }