MediaWiki:CollapsibleTree.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)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Hide nested lists by default to prevent FOUC */
.collapsible-tree > ul ul {
display: none;
}
.collapsible-tree > ul {
margin: 0;
padding-left: 28px;
list-style: none;
line-height: 2.2em;
}
.collapsible-tree > ul li {
position: relative;
transition: all 0.2s ease;
}
.collapsible-tree > ul li a {
padding-left: 0.5rem;
color: #2563eb;
text-decoration: none;
transition: color 0.2s ease;
}
.collapsible-tree > ul li a:hover {
color: #1e40af;
text-decoration: underline;
}
/* Modern tree lines with smoother styling */
.collapsible-tree > ul li::before,
.collapsible-tree > ul li::after {
content: "";
position: absolute;
left: -18px;
border-left: 1px solid #d1d5db;
}
.collapsible-tree > ul li::before {
top: 0;
width: 18px;
height: 1.1em;
border-bottom: 1px solid #d1d5db;
}
/* Hide vertical line for first item */
.collapsible-tree > ul > li:first-child::before {
border-left: none;
}
.collapsible-tree > ul li::after {
top: 1.1em;
bottom: 1px;
}
/* Hide lines for last item */
.collapsible-tree > ul li:last-child::after {
display: none;
}
/* Modern toggle icon */
.js-toggle-icon {
position: relative;
z-index: 1;
display: inline-flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
margin: 0 4px 0 -26px;
cursor: pointer;
font-style: normal;
font-size: 12px;
font-weight: 600;
background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
border: 1px solid #d1d5db;
border-radius: 3px;
color: #4b5563;
transition: all 0.2s ease;
user-select: none;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.js-toggle-icon:hover {
background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
border-color: #9ca3af;
color: #1f2937;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
transform: scale(1.05);
}
.js-toggle-icon:active {
transform: scale(0.95);
box-shadow: 0 0 0 rgba(0, 0, 0, 0.05);
}
/* Highlight parent items with children */
.collapsible-tree > ul li.has-children > a {
font-weight: 500;
}
/* Optional: Add subtle hover effect to tree items */
.collapsible-tree > ul li:hover > a {
background-color: rgba(59, 130, 246, 0.05);
border-radius: 3px;
margin-left: -4px;
padding-left: calc(0.5rem + 4px);
}
.collapsible-tree ul,
.collapsible-tree li {
list-style: none;
}