MediaWiki:WikiTable.css
From The Seven Sages of Rome
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)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Modern WikiTable Styles */
.wikitable {
background-color: #f8f8f8;
border-collapse: separate;
border-spacing: 0;
margin: 1em 0;
width: 100%;
position: relative;
}
/* Table Header */
.wikitable > tr > th,
.wikitable > * > tr > th {
background-color: #f8f8f8;
border: none;
border-bottom: 2px solid #e2e8f0;
padding: 1rem 0.75rem;
color: black;
font-size: 1.1rem;
font-weight: 700;
text-align: left;
vertical-align: middle;
}
/* First header row styling for multi-row headers */
.wikitable > thead > tr:first-child > th {
background-color: #ffffff;
border-bottom: none;
}
/* Table Cells */
.wikitable > tr > td,
.wikitable > * > tr > td {
border: none;
border-bottom: 1px solid #e2e8f0;
padding: 0.875rem 0.75rem;
vertical-align: middle;
color: #334155;
}
/* Last row has no border */
.wikitable > tr:last-child > td,
.wikitable > * > tr:last-child > td {
border-bottom: none;
}
/* Striped rows */
.wikitable > tr:nth-child(even),
.wikitable > * > tr:nth-child(even) {
background-color: #ffffff;
}
/* Hover effect */
.wikitable > tbody > tr:hover,
.wikitable > * > tbody > tr:hover {
background-color: #f1f5f9;
transition: background-color 0.2s ease-in-out;
}
/* First column styling */
.wikitable > tr > td:first-child,
.wikitable > * > tr > td:first-child {
font-weight: 500;
}
/* Responsive table wrapper */
.table-responsive {
display: block;
width: 100%;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
margin-bottom: 1.5rem;
border-radius: 10px;
max-height: 80vh; /* For fixed header scrolling */
}
/* Sort indicators if sortable tables are used */
.wikitable th.headerSort {
cursor: pointer;
position: relative;
}
.wikitable th.headerSort:after {
content: '⇅';
display: inline-block;
margin-left: 0.5em;
opacity: 0.5;
font-size: 0.875rem;
}
.wikitable th.headerSortUp:after {
content: '↑';
opacity: 1;
}
.wikitable th.headerSortDown:after {
content: '↓';
opacity: 1;
}
/* Caption styling */
.wikitable > caption {
padding: 0.75rem;
color: #64748b;
text-align: left;
caption-side: top;
font-style: italic;
font-weight: 500;
background-color: #f8fafc;
border-bottom: 1px solid #e2e8f0;
border-radius: 10px 10px 0 0;
}
/* Apply fixed header for the WikiTable */
.table-fixed-header {
max-height: 600px;
overflow-y: auto;
border-radius: 10px;
}
/* Mobile optimizations */
@media (max-width: 768px) {
.wikitable > tr > th,
.wikitable > * > tr > th,
.wikitable > tr > td,
.wikitable > * > tr > td {
padding: 0.625rem 0.5rem;
font-size: 0.875rem;
}
.table-fixed-header {
max-height: 400px;
}
}
/* For two-column layout adjustments */
.container-fluid .row .col-md-6 {
padding-left: 0.75rem;
padding-right: 0.75rem;
}
/* Increase spacing between tables */
.wikitable.mb-4 {
margin-bottom: 1.5rem !important;
}
/* Optional: Property-value column alignment for better readability */
.wikitable > tbody > tr > td:first-of-type {
width: 40%;
}
.wikitable > tbody > tr > td:last-of-type {
width: 60%;
}