跳转到内容

MediaWiki:Common.css

来自槌基百科
LocalAdmin留言 | 贡献2026年3月12日 (四) 10:57的版本 (Site-wide UI polish: page bg, headings, TOC, tables, typography)

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
/* 这里放置的CSS将应用于所有皮肤 */
.infobox {
    border: 1px solid #aaa;
    background-color: #f9f9f9;
    color: black;
    margin-bottom: 10px;
    padding: 15px;
    float: right;
    clear: right;
}

/* Hide unnecessary ConfirmAccount fields */
#wpRealName,
label[for="wpRealName"],
#wpCV,
label[for="wpCV"],
#wpNotes,
label[for="wpNotes"],
#wpSites,
label[for="wpSites"],
#wpTermsBox,
label[for="wpTermsBox"],
#mw-confirmaccount-info,
#mw-confirmaccount-terms {
    display: none !important;
}

/* Make biography field one-line */
#wpBio {
    height: 2em !important;
}

/* Hide description text below biography label */
#mw-confirmaccount-bio > p {
    display: none !important;
}

/* Fully hide the "Other Information" section */
fieldset:has(legend#mw-confirmaccount-attach) {
    display: none !important;
}

/* ── AllPages: 4-column layout ─────────────────────────────────────── */
.mw-allpages-body {
    column-count: 1 !important; /* neutralise MediaWiki's default 2-col on this wrapper */
}
.mw-allpages-chunk {
    column-count: 4;
    column-gap: 1.5em;
    list-style: none;
    padding: 0;
}
.mw-allpages-chunk li {
    break-inside: avoid;
    padding: 0.15em 0;
}
@media (max-width: 900px) {
    .mw-allpages-chunk { column-count: 2; }
}
@media (max-width: 500px) {
    .mw-allpages-chunk { column-count: 1; }
}

/* ── Character infobox: modern card style ───────────────────────── */

/* Card shell */
table.infobox.biography {
    background: #ffffff !important;
    border: none !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18) !important;
    border-spacing: 0 !important;
    overflow: hidden;
    margin: 0 0 1.2em 1.5em !important;
    width: 240px !important;
}

/* Character name caption */
table.infobox.biography > caption {
    background: #2c3a4a !important;
    color: #ffffff !important;
    font-size: 1.15em !important;
    font-weight: 700 !important;
    padding: 0.55em 0.8em !important;
    letter-spacing: 0.04em;
    border-radius: 14px 14px 0 0;
    caption-side: top;
}

/* Image header row — replace the dated blue with dark neutral */
table.infobox.biography > tbody > tr:first-child > th {
    background: #3d4f63 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    text-align: center !important;
}

/* Image fills the header area */
table.infobox.biography > tbody > tr:first-child > th img {
    display: block !important;
    width: 100% !important;
    height: 200px !important;
    object-fit: cover !important;
    object-position: top center !important;
    margin: 0 auto !important;
}

/* Data rows */
table.infobox.biography > tbody > tr + tr {
    border-top: 1px solid #eef0f3;
}

/* Label cells */
table.infobox.biography > tbody > tr > th {
    background: #f7f8fb !important;
    color: #555 !important;
    font-weight: 600 !important;
    font-size: 0.88em !important;
    padding: 0.45em 0.75em !important;
    white-space: nowrap;
    width: 38%;
    vertical-align: middle;
}

/* Value cells */
table.infobox.biography > tbody > tr > td {
    background: #ffffff !important;
    color: #222 !important;
    padding: 0.45em 0.75em !important;
    font-size: 0.9em !important;
    vertical-align: middle;
}

/* Last row — round bottom corners */
table.infobox.biography > tbody > tr:last-child > th,
table.infobox.biography > tbody > tr:last-child > td {
    border-radius: 0 0 0 14px;
}
table.infobox.biography > tbody > tr:last-child > td:last-child {
    border-radius: 0 0 14px 0;
}

/* ═══════════════════════════════════════════════════════════════════
   SITE-WIDE UI POLISH
   Palette: --dark #2c3a4a  --accent #4a7fa5  --light-bg #f7f8fb
            --border #e0e4ea  --text #1f2937
   ═══════════════════════════════════════════════════════════════════ */

/* ── Page background ──────────────────────────────────────────────── */
body {
    background-color: #eef0f4 !important;
}

/* Content area: white card floating on the grey bg */
#content,
.mw-body {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.09);
    border: none !important;
    padding: 1.8em 2em !important;
    margin-top: 0.8em;
}

/* ── Page title (h1) ──────────────────────────────────────────────── */
h1.firstHeading,
#firstHeading {
    font-size: 1.9em;
    font-weight: 800;
    color: #2c3a4a;
    border-bottom: 3px solid #4a7fa5 !important;
    padding-bottom: 0.3em;
    margin-bottom: 0.7em;
    letter-spacing: 0.01em;
}

/* ── Section headings ─────────────────────────────────────────────── */
.mw-body-content h2 {
    font-size: 1.3em;
    font-weight: 700;
    color: #2c3a4a;
    border-bottom: none !important;
    border-left: 4px solid #4a7fa5;
    padding: 0.25em 0 0.25em 0.65em;
    margin: 1.4em 0 0.6em;
    background: #f7f8fb;
    border-radius: 0 6px 6px 0;
}

.mw-body-content h3 {
    font-size: 1.1em;
    font-weight: 700;
    color: #2c3a4a;
    border-bottom: 1px solid #e0e4ea !important;
    padding-bottom: 0.2em;
    margin: 1.1em 0 0.5em;
}

.mw-body-content h4 {
    font-size: 1em;
    font-weight: 600;
    color: #3d4f63;
}

/* ── Body text ────────────────────────────────────────────────────── */
.mw-body-content p {
    line-height: 1.8;
    color: #1f2937;
    margin-bottom: 0.7em;
}

/* ── Links ────────────────────────────────────────────────────────── */
.mw-body-content a {
    color: #3671b5;
}
.mw-body-content a:hover {
    color: #2c3a4a;
    text-decoration: underline;
}
/* Red links (missing pages) */
.mw-body-content a.new {
    color: #c0392b;
}

/* ── Table of Contents ────────────────────────────────────────────── */
.mw-table-of-contents,
#toc,
.toc {
    background: #f7f8fb;
    border: 1px solid #e0e4ea !important;
    border-radius: 10px;
    padding: 0.8em 1.2em !important;
    display: inline-block;
    min-width: 200px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.mw-table-of-contents ul,
#toc ul,
.toc ul {
    margin: 0.2em 0 0 1em !important;
}
.mw-table-of-contents .toctitle,
#toc .toctitle {
    font-weight: 700;
    color: #2c3a4a;
    font-size: 0.95em;
}

/* ── Default wiki tables ──────────────────────────────────────────── */
.mw-body-content table:not(.infobox):not(.mw-allpages-table-chunk) {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.mw-body-content table:not(.infobox) th {
    background: #2c3a4a !important;
    color: #fff !important;
    padding: 0.5em 0.8em !important;
    font-weight: 600;
    text-align: left;
}
.mw-body-content table:not(.infobox) td {
    padding: 0.45em 0.8em !important;
    border-bottom: 1px solid #e0e4ea;
    color: #1f2937;
}
.mw-body-content table:not(.infobox) tr:last-child td {
    border-bottom: none;
}
.mw-body-content table:not(.infobox) tr:nth-child(even) td {
    background: #f7f8fb;
}

/* ── Blockquotes ──────────────────────────────────────────────────── */
.mw-body-content blockquote {
    border-left: 4px solid #4a7fa5;
    background: #f7f8fb;
    margin: 0.8em 0;
    padding: 0.6em 1em;
    border-radius: 0 6px 6px 0;
    color: #3d4f63;
    font-style: italic;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
#mw-panel,
.vector-sidebar {
    padding-top: 0.5em;
}
.vector-menu-content-list a {
    color: #2c3a4a !important;
    font-size: 0.9em;
}
.vector-menu-content-list a:hover {
    color: #4a7fa5 !important;
}
.vector-menu-portal-more .vector-menu-heading {
    color: #4a7fa5 !important;
    font-weight: 700;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Search bar ───────────────────────────────────────────────────── */
.cdx-search-input__input {
    border-radius: 20px !important;
    border: 1.5px solid #c8d0dc !important;
}
.cdx-search-input__input:focus {
    border-color: #4a7fa5 !important;
    box-shadow: 0 0 0 2px rgba(74,127,165,0.15) !important;
}

/* ── Section edit links ───────────────────────────────────────────── */
.mw-editsection {
    font-size: 0.75em;
    background: #f0f4f8;
    border-radius: 4px;
    padding: 0 0.4em;
}
.mw-editsection a {
    color: #4a7fa5 !important;
}