MediaWiki:Common.css
Appearance
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* =========================================================
TRUE center search (independent of left/right header content)
Vector 2022
========================================================= */
/* Make header positioning context */
.mw-header {
position: relative !important;
}
/* Absolutely center the search box */
.mw-header .vector-search-box,
.mw-header #p-search {
position: absolute !important;
left: 50% !important;
transform: translateX(-50%) !important;
width: min(720px, calc(100vw - 520px)) !important; /* leaves room for left+right UI */
margin: 0 !important;
}
/* Keep the search vertically aligned */
.mw-header .vector-search-box {
top: 50% !important;
transform: translate(-50%, -50%) !important;
}
/* Ensure user tools stay right and above any overlap */
.mw-header .vector-user-links,
.mw-header .mw-header-user,
.mw-header .vector-user-menu,
.mw-header .vector-user-menu-container {
position: relative !important;
z-index: 2 !important;
}
/* Ensure logo/menu stays left and above any overlap */
.mw-header .mw-logo,
.mw-header .mw-header-start,
.mw-header .vector-header-start {
position: relative !important;
z-index: 2 !important;
}
@media (max-width: 900px) {
.mw-header .vector-search-box,
.mw-header #p-search {
position: static !important;
transform: none !important;
width: 100% !important;
margin: 8px 0 0 !important;
}
}
/* =========================================================
Vector 2022: proper header layout
Left (logo/menu) · Center (search) · Right (user/login)
No absolute positioning
========================================================= */
/* Undo any previous absolute-centering rules */
.mw-header .vector-search-box,
.mw-header #p-search {
position: static !important;
left: auto !important;
top: auto !important;
transform: none !important;
margin: 0 !important;
width: auto !important;
}
/* Vector 2022 header container becomes a 3-zone flex row */
.mw-header .vector-header-container {
display: flex !important;
align-items: center !important;
gap: 16px !important;
}
/* Left zone */
.mw-header .vector-header-start {
flex: 0 0 auto !important;
}
/* Middle zone: take remaining space and center contents */
.mw-header .vector-header-middle {
flex: 1 1 auto !important;
display: flex !important;
justify-content: center !important;
}
/* Right zone: stick to far right */
.mw-header .vector-header-end {
flex: 0 0 auto !important;
margin-left: auto !important;
display: flex !important;
justify-content: flex-end !important;
}
/* Search sizing (centered) */
.mw-header .vector-header-middle .vector-search-box,
.mw-header .vector-header-middle #p-search {
width: min(720px, 100%) !important;
}
/* =========================================================
Center ONLY the search bar (do not affect header layout)
Vector 2022 safe adjustment
========================================================= */
/* Target the search container only */
.mw-header .vector-search-box,
.mw-header #p-search {
margin-left: auto !important;
margin-right: auto !important;
max-width: 720px !important;
width: 100% !important;
}
/* =========================================================
Center ONLY the search bar (override right-aligned container)
========================================================= */
/* Make the header a positioning context (doesn't move other items) */
.mw-header {
position: relative !important;
}
/* Center the search element itself */
.mw-header .vector-search-box,
.mw-header #p-search {
position: absolute !important;
left: 50% !important;
top: 50% !important;
transform: translate(-50%, -50%) !important;
width: min(720px, calc(100vw - 520px)) !important; /* leaves room for logo + user menu */
margin: 0 !important;
}
/* Small screens: revert to normal flow so nothing overlaps */
@media (max-width: 900px) {
.mw-header .vector-search-box,
.mw-header #p-search {
position: static !important;
transform: none !important;
width: 100% !important;
margin: 15px 0 0 !important;
}
}