MediaWiki talk:Common.css

From The Perfect Tower II
Revision as of 20:26, 28 March 2021 by Lmnt0 (talk | contribs) (→‎Add CSS to enable table column alignment)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Add CSS to enable ToC depth limit

Propose adding CSS which allows limiting the page ToC to a specified depth (useful for pages with long ToCs such as Military Tier)

/*
 * Allow limiting of which header levels are shown in a TOC;
 * <div class="toclimit-3">, for instance, will limit to
 * showing ==headings== and ===headings=== but no further.
 * Used in [[Template:TOC]]
 * From: https://www.mediawiki.org/wiki/MediaWiki:Gadget-site.css
 */
.toclimit-2 .toclevel-1 ul,
.toclimit-3 .toclevel-2 ul,
.toclimit-4 .toclevel-3 ul,
.toclimit-5 .toclevel-4 ul,
.toclimit-6 .toclevel-5 ul,
.toclimit-7 .toclevel-6 ul {
	display: none;
}

Lmnt0 (talk) 23:09, 24 February 2021 (CET)

Add CSS to enable table column alignment

Propose adding CSS to give the ability to align an entire table column by assigning a table class, rather than having to assign each cell's alignment individually

/*
 * Allow center- or right- aligning an entire table column
 * e.g.
 * {| class="wikitable col-3-right col-4-right"
 * ...
 * |}
 * From: https://stackoverflow.com/questions/24494604/mediawiki-table-efficiently-applying-different-alignment-for-different-column
 */
table.col-1-center td:nth-child(1) { text-align: center; }
table.col-2-center td:nth-child(2) { text-align: center; }
table.col-3-center td:nth-child(3) { text-align: center; }
table.col-4-center td:nth-child(4) { text-align: center; }
table.col-5-center td:nth-child(5) { text-align: center; }
table.col-6-center td:nth-child(6) { text-align: center; }
table.col-7-center td:nth-child(7) { text-align: center; }
table.col-8-center td:nth-child(8) { text-align: center; }
table.col-9-center td:nth-child(9) { text-align: center; }

table.col-1-right td:nth-child(1) { text-align: right; }
table.col-2-right td:nth-child(2) { text-align: right; }
table.col-3-right td:nth-child(3) { text-align: right; }
table.col-4-right td:nth-child(4) { text-align: right; }
table.col-5-right td:nth-child(5) { text-align: right; }
table.col-6-right td:nth-child(6) { text-align: right; }
table.col-7-right td:nth-child(7) { text-align: right; }
table.col-8-right td:nth-child(8) { text-align: right; }
table.col-9-right td:nth-child(9) { text-align: right; }

Lmnt0 (talk) 21:25, 28 March 2021 (CEST)