How could I change the background css of a menu’s parent?

Asked

Viewed 31 times

0

I am using boostrap. I would like to change the "my-Parent" menu with CSS when it is in the "Collapse.in class":

<nav class="col-xs-12 col-md-2 pull-left meu-parent">
    <div class="menu-dropdown-test"> <!-- collapse.in só aparece quando ele está com o collapse ativo, acontece logo aqui abaixo:  -->
        <div class="navbar-collapse navbar-menubuilder collapse in" aria-expanded="true" style="">
            <ul class="nav navbar-nav navbar-left menu-webapp-v2">
                <li><a href="/webapp/home"><i class="item-leitura"></i><span>Leitura</span></a></li>
                <li><a href="/webapp/conquistas"><i class="item-conquistas"></i><span>Conquistas</span></a></li>
                <li><a href="/webapp/a-producao-textual"><i class="item-producao-textual"></i><span>Produção textual</span></a></li>
                <li class="nav-close"><a href="/webapp/sair"><i class="item-sair"></i>Sair</a></li>
            </ul>
        </div>
    </div>
</nav>

Is there any way to make Collapse.in css work for a Parent > Parent? Because I need to change the background to a black with 0.6 opacity when the dropdown menu is open (with Collapse.in).

  • I think you can only change child elements, not parents. Maybe it is possible to do this jQuery.

  • I need certainty in this information.

  • 1

    I did a quick search here and it’s certainty that there’s no way to select parent elements in CSS, as I thought. It’s using JS.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.