Template:Portal Box/styles.css: Difference between revisions
Created page with "→* Portal grid layout + card styling. * Usage: wrap <div class="mw-portal-grid">...</div> around multiple {{Portal box}} calls.: →Grid container — place this on the page wrapping the boxes: .mw-portal-grid { display: flex; flex-flow: row wrap; gap: 16px; margin: 1em 0; } →Individual card: .mw-portal-box { flex: 1 1 220px; →grow, shrink, min-width — gives ~3 col on desktop: break-inside: avoid; border: 1px solid v..." |
No edit summary |
||
| Line 1: | Line 1: | ||
/* | /* | ||
* Portal grid layout + card styling. | * Portal grid layout + section card styling. | ||
* | * Adapted from Template:Navigation_Wikimedia_infrastructure/style.css | ||
* | |||
* Outer wrapper pattern (place on the page, not in this template): | |||
* <div class="infranav infranav--portal"> | |||
* <div class="infranav-title">Title</div> | |||
* <div class="infranav-contents">{{Portal Box|...}} ...</div> | |||
* </div> | |||
* | |||
* Each {{Portal Box}} call generates one .infranav-section. | |||
*/ | */ | ||
/* | /* ── Outer container ─────────────────────────────────────────────────────── */ | ||
. | .infranav { | ||
border: 1px solid var(--border-color-base, #a2a9b1); | |||
background: var(--background-color-neutral-subtle, #f8f9fa); | |||
color: var(--color-base, #202122); | |||
font-size: 88%; | |||
line-height: 1.5; | |||
} | |||
/* ── Portal mode ─────────────────────────────────────────────────────────── */ | |||
.infranav--portal { | |||
float: none; | |||
max-width: initial; | |||
clear: both; | |||
margin: 1em 0; | |||
} | |||
.infranav--portal .infranav-title { | |||
font-weight: bold; | |||
text-align: center; | |||
padding: 4px 8px; | |||
background: #3366cc; | |||
color: #fff; | |||
border-bottom: 1px solid var(--border-color-base, #a2a9b1); | |||
} | |||
.infranav--portal .infranav-contents { | |||
margin: 0 8px; | |||
padding: 8px 0; | |||
display: flex; | display: flex; | ||
flex-flow: row wrap; | flex-flow: row wrap; | ||
gap: 16px; | gap: 16px; | ||
} | } | ||
.infranav--portal .infranav-section { | |||
. | |||
break-inside: avoid; | break-inside: avoid; | ||
flex: 1 1 180px; | |||
min-width: 160px; | |||
} | |||
.infranav--portal .infranav-heading { | |||
font-weight: bold; | |||
border-bottom: 1px solid var(--border-color-base, #a2a9b1); | |||
margin-bottom: 4px; | |||
padding-bottom: 2px; | |||
} | } | ||
. | /* ── Sidebar mode ────────────────────────────────────────────────────────── */ | ||
.infranav--sidebar { | |||
float: right; | |||
clear: right; | |||
width: 14em; | |||
margin: 0 0 1em 1em; | |||
} | |||
.infranav--sidebar .infranav-title { | |||
font-weight: bold; | |||
text-align: center; | |||
padding: 4px 8px; | |||
background: #3366cc; | background: #3366cc; | ||
color: #fff; | color: #fff; | ||
border-bottom: 1px solid var(--border-color-base, #a2a9b1); | |||
} | } | ||
.infranav--sidebar .infranav-contents { | |||
. | padding: 4px 0; | ||
padding: 4px | |||
} | } | ||
. | .infranav--sidebar .infranav-heading { | ||
font-weight: normal; | |||
margin: 1px 0 0 0; | |||
} | } | ||
. | .infranav--sidebar .infranav-heading a { | ||
margin: | display: block; | ||
border-top: 1px solid var(--border-color-base, #a2a9b1); | |||
background-color: var(--background-color-neutral-subtle, #f8f9fa); | |||
color: var(--color-base, #202122); | |||
margin: 0 -8px; | |||
padding: 4px 8px 0 8px; | |||
} | } | ||
.infranav--sidebar .infranav-heading a:hover { | |||
background-color: var(--background-color-base, #fff); | |||
. | color: var(--color-emphasized, #000); | ||
} | } | ||
.infranav--sidebar .infranav-section { | |||
padding: 0 8px; | |||
} | } | ||
/* Dark mode | /* ── Shared list styles ──────────────────────────────────────────────────── */ | ||
.infranav .infranav-section ul { margin-top: unset !important; margin-bottom: 4px; } | |||
.infranav .infranav-section li { margin: 1px 0; } | |||
/* ── Dark mode ───────────────────────────────────────────────────────────── */ | |||
@media screen { | @media screen { | ||
html.skin-theme-clientpref-night . | html.skin-theme-clientpref-night .infranav--portal .infranav-title, | ||
html.skin-theme-clientpref-night .infranav--sidebar .infranav-title { background: #1a3a5c; } | |||
} | } | ||
@media screen and (prefers-color-scheme: dark) { | @media screen and (prefers-color-scheme: dark) { | ||
html.skin-theme-clientpref-os . | html.skin-theme-clientpref-os .infranav--portal .infranav-title, | ||
html.skin-theme-clientpref-os .infranav--sidebar .infranav-title { background: #1a3a5c; } | |||
} | } | ||