MediaWiki:Common.css

来自神国反恶俗
七叶​(留言 | 贡献)2026年10月10日 (六) 13:54的版本
跳到导航跳到搜索

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

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
  • Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
  • Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5。
/* 这里放置的CSS将应用于所有皮肤 */

/* ============================================================
   MediaWiki:Common.css  ——  神国维基全站样式
   ============================================================ */

/* ------------------------------------------------------------
   ① 目录(TOC):去掉默认的浮动与边框,改成整块显示
   ------------------------------------------------------------ */
.mw-table-of-contents-container,
.mw-table-of-contents,
#toc,
.toc {
    float: none;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font-size: 1em;
}

#p-toc .pBody {
    max-height: 70vh;
    overflow-y: auto;
    font-size: 0.9em;
    line-height: 1.6;
}

#p-toc ul {
    margin: 0;
    padding-left: 1.6em;
}

#p-toc .toctitle,
#p-toc .mw-table-of-contents__heading,
#p-toc .mw-table-of-contents-header {
    display: none;
}

/* ------------------------------------------------------------
   ② 左侧导航栏:随屏幕滚动固定
   ------------------------------------------------------------ */
#column-one,
.mw-portlet,
.vector-menu-portal,
.sidebar-inner {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
}

/* ------------------------------------------------------------
   ③ 顶部两排栏固定
   ------------------------------------------------------------ */

/* 第一排(右上角):七叶 / 讨论 / 参数设置 / 监视列表 / 贡献 / 退出 */
#p-personal {
    position: fixed !important;
    top: 0 !important;
    right: 12px !important;
    left: auto !important;
    margin: 0 !important;
    padding: 5px 12px !important;
    background: #ffffff;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
    z-index: 301;
}

/* 第二排(左侧):页面 / 讨论 / 编辑源代码 / 历史 / 删除 */
#p-cactions {
    position: fixed !important;
    top: 34px !important;
    left: 50% !important;
    margin-left: -505px !important;
    padding: 4px 10px !important;
    background: #ffffff;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
    z-index: 300;
}

/* 正文往下让出两排的高度 */
#content {
    padding-top: 34px;
}
#p-cactions:empty,
#p-cactions:has(ul:empty) {
    display: none !important;
}

body:not(:has(#p-cactions li)) #content {
    padding-top: 0;
}

/* ------------------------------------------------------------
   ④ 标签栏美化:圆角 + 当前页橙色高亮
   ------------------------------------------------------------ */
#p-cactions ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

#p-cactions li {
    display: inline-block;
    margin: 0 2px 0 0;
    padding: 0;
    background: #ffffff;
    border: 1px solid #c8ccd1;
    border-radius: 6px 6px 0 0;
}

#p-cactions li:hover {
    background: #eaf3ff;
    border-color: #36c;
}

#p-cactions li.selected {
    background: #ffffff;
    border: 2px solid #f7941d;
    font-weight: bold;
}

#p-cactions li a {
    display: block;
    padding: 5px 12px;
    color: #36c;
    text-decoration: none;
}

#p-cactions li.selected a {
    color: #b32424;
}

#p-cactions li a:hover {
    text-decoration: none;
}

/* ------------------------------------------------------------
   ⑤ 窄屏(小于 900px)放开固定
   ------------------------------------------------------------ */
@media screen and (max-width: 900px) {
    #p-personal,
    #p-cactions {
        position: static !important;
        margin-left: 0 !important;
        box-shadow: none;
        border-radius: 0;
    }

    #content {
        padding-top: 0;
    }
}