Archived topic
Apply CSS to menu item
3 replies · Started by Radek on December 19, 2019
Hi, what is the best way to apply some CSS to menu item ? What I need is make one menu item looks like active (or hover) on few single posts. Is it possible use Elements for this ? Thank You.
Hi there,
Each menu item has a unique ID if you inspect it in developer tools (right-click + inspect): https://www.screencast.com/t/FDozu66g
So you can do this:
#menu-item-594521 {
background-color: red;
color: white;
}
Hope this helps :)
Hi Tom, sorry maybe wrong question. Of course I know this. What I need is push "some" CSS to this ID if some posts is open. For understanding, this menu item represent one page where is block of posts and if I open one of that post I need this menu item looks like current (menu item does not represent category of that posts, so automatic "current" look does not work). Do You understand ? Sorry for my english.
Ah, sorry. This topic might be helpful: https://generatepress.com/forums/topic/how-to-set-menu-choice-as-current-in-certain-pages/