Difference between revisions of "MediaWiki:Common.css"
Jump to navigation
Jump to search
(Created page with "→Style the TOC container: #toc { position: fixed; →Makes it sticky: top: 10px; →Distance from the top of the viewport: left: 10px; /* Distance from the...") |
|||
| (36 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
#toc { | #toc { | ||
position: fixed; /* Makes it sticky */ | position: fixed; /* Makes it sticky */ | ||
| − | top: | + | top: 450px; /* Distance from the top of the viewport */ |
left: 10px; /* Distance from the left of the viewport */ | left: 10px; /* Distance from the left of the viewport */ | ||
| − | width: | + | width: 280px; /* Set a fixed width for the TOC */ |
| − | max-height: | + | max-height: 150vh !important; /* Prevent it from overflowing the viewport height */ |
| − | overflow-y: auto; /* Add a scrollbar if the TOC is too long */ | + | overflow-y: auto !important; /* Add a scrollbar if the TOC is too long */ |
background-color: #f9f9f9; /* Optional: Background colour for better visibility */ | background-color: #f9f9f9; /* Optional: Background colour for better visibility */ | ||
border: 1px solid #ccc; /* Optional: Add a border */ | border: 1px solid #ccc; /* Optional: Add a border */ | ||
| Line 17: | Line 17: | ||
/* Add some spacing to the main content to avoid overlap */ | /* Add some spacing to the main content to avoid overlap */ | ||
body { | body { | ||
| − | margin-left: | + | margin-left: 145px; /* Adjust based on the TOC width */ |
} | } | ||
Latest revision as of 03:28, 2 July 2025
/* Style the TOC container */
#toc {
position: fixed; /* Makes it sticky */
top: 450px; /* Distance from the top of the viewport */
left: 10px; /* Distance from the left of the viewport */
width: 280px; /* Set a fixed width for the TOC */
max-height: 150vh !important; /* Prevent it from overflowing the viewport height */
overflow-y: auto !important; /* Add a scrollbar if the TOC is too long */
background-color: #f9f9f9; /* Optional: Background colour for better visibility */
border: 1px solid #ccc; /* Optional: Add a border */
padding: 10px; /* Optional: Add padding */
z-index: 1000; /* Ensure it stays above other elements */
}
/* Add some spacing to the main content to avoid overlap */
body {
margin-left: 145px; /* Adjust based on the TOC width */
}