Skip to content

Commit 92379cc

Browse files
committed
Highlight current section
1 parent fa9e8e5 commit 92379cc

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

src/Elastic.Documentation.Site/Assets/styles.css

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,60 @@ body {
178178
@apply text-blue-elastic! font-semibold;
179179
}
180180

181+
/* Highlight the active section: parent li and all sibling li elements */
182+
#pages-nav li:has(ul a.current),
183+
#pages-nav li:has(ul a.current) > ul > li {
184+
position: relative;
185+
}
186+
187+
#pages-nav li:has(ul a.current)::before,
188+
#pages-nav li:has(ul a.current) > ul > li::before {
189+
content: '';
190+
position: absolute;
191+
top: -12px;
192+
left: -12px;
193+
right: -12px;
194+
bottom: -12px;
195+
@apply bg-grey-10 rounded-lg;
196+
z-index: -1;
197+
}
198+
199+
/* Also highlight when the parent itself is the current item */
200+
#pages-nav li:has(> a.current),
201+
#pages-nav li:has(> a.current) ~ li {
202+
position: relative;
203+
}
204+
205+
#pages-nav li:has(> a.current)::before,
206+
#pages-nav li:has(> a.current) ~ li::before {
207+
content: '';
208+
position: absolute;
209+
top: -12px;
210+
left: -12px;
211+
right: -12px;
212+
bottom: -12px;
213+
@apply bg-grey-10 rounded-lg;
214+
z-index: -1;
215+
}
216+
217+
/* Also highlight all children when the parent itself is current */
218+
#pages-nav li:has(> div > a.current),
219+
#pages-nav li:has(> div > a.current) > ul > li {
220+
position: relative;
221+
}
222+
223+
#pages-nav li:has(> div > a.current)::before,
224+
#pages-nav li:has(> div > a.current) > ul > li::before {
225+
content: '';
226+
position: absolute;
227+
top: -12px;
228+
left: -12px;
229+
right: -12px;
230+
bottom: -12px;
231+
@apply bg-grey-10 rounded-lg;
232+
z-index: -1;
233+
}
234+
181235
.markdown-content {
182236
@apply font-body;
183237
}

0 commit comments

Comments
 (0)