Archived topic

Widget - Active Link Color

11 replies · Started by John on September 4, 2020

Viewing posts 1–12 of 12

Hi:

I'd like to have an active widget link color for a logged-in user.

This is what I've tried but it's not working.

body.logged-in .sidebar .widget ul li a:active {
    color: green;
    font-weight: bold;
} 

Thanks!

Hi there,

That looks good as long as the link is in a list.

Can you link me to the page in question?

Thanks, Leo

You will have to log-in

LOGIN URL removed by author
user: removed by author
pass: removed by author

I'm not seeing the link in the sidebar (Monthly Events) reflecting the CSS (Green and bold)

SCREENSHOT

I've cleared browser and server caches.

Ahh I think I know where the misunderstanding is coming from. :active doesn't work like that as the menu item.

I believe this is what you want:

body.logged-in .sidebar .widget ul li.current-menu-item a {
    color: #000 !important;
}

Yes, that worked. Thank you.

How important is !important? If I remove !important it still works. Is it better to leave it in?

I'm curious as to why you check the :active box in Force Element State, in dev tools.

You can remove !important if it still works without it - it didn't work for me when I tried.

I was just trying to see if your CSS was applying.

Hi,

I have a follow-up question.

body.logged-in .sidebar .widget ul li.current-menu-item a {
    color: #000 !important;
}

This CSS works for the menu links in the sidebar navigation widget, but it doesn't work on the categories widget which is directly below it. Can this be modified to include those links in the categories widget?

https://www.leylatorresstudio.com/member-login/

testuser2
stf4nwaozIhB!o95KLGmwhQ(

Try this:

body.logged-in .sidebar .widget ul li.current-menu-item a,
body.logged-in .sidebar .widget ul li.current-cat a {
    color: #000 !important;
}
This archived topic is closed to new replies.