i have the followwing structure in my html code:
<ul id="urlcss">
<li class="nav-submenu">
<a class="collapsed" href="#" data-toggle="collapse" data-target="#submenu0">
ADMIN
</a>
<div class="collapse" id="submenu0" aria-expanded="false">
// Some menus check the image below
</div>
</li>
</ul>
And if you see that on browser, it looks like this:
With the menu collapse show, like this:
Ok what i want to do is, when a user press the li with nav-submenu class i want to show an arrow indicating that the collapse menu below belong to that li, and change the background color, i tried with css but nothing happens, here is an example of what i want (Look the arrow):
I tried doing this piece of code to place something like a holder but i doesn’t work:
.nav-submenu[data-toggle].collapsed:after {
content: " ▾";
}
.nav-submenu[data-toggle]:not(.collapsed):after {
content: " ▴";
}
2
Answers
This is using BootStrap 5 Nav Using Dropdowns
With very little css you can achieve what you are looking for.
I’ve created for you a small example. Also is used a small js code to toggle default class name.