- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hello:
I know this is like CSS 101, and normally I’m good with specifying descendants, but I can’t get this example to work. Basically I want a little X character* to appear before an li item that has the class .current_page_item
. I also only want this arrow to appear in a sub-list.
I’ve set up a codepen here: https://codepen.io/compoundeye/pen/NaWNQX
What I want: for only ‘Working in Partnership’ to have the X.
What I don’t want: for ‘About Us’ to have the arrow X. Since this is the parent page (and Working in Parternship is the child page), I’ll format ‘About Us’ differently.
I’ve tried this CSS rule but it didn’t work:
aside#advanced_sidebar_menu-2
ul.child-sidebar-menu
li.current_page_item a::before {
content: "X";
font-family: helvetica;
padding-right:5px;
}
… that just got rid of all Xs.
The working page where this sidebar menu is in action is here: http://ukandglobal.com/new/about-us/.
OK, thanks in advance for any suggestions.
Cheers, Russell
Hi there
just put direct descendant like:
aside#advanced_sidebar_menu-2
ul.child-sidebar-menu
li.current_page_item > a::before {
content: "X";
font-family: helvetica;
padding-right:5px;
}
paste this code, it will work.
I think that’s the other way around, the X should only appear in the second listitem.
So the selector should have the second listitem in it, something like this: aside#advanced_sidebar_menu-2 li.current_page_item li a::before