locked
rotating caret RRS feed

  • Question

  • User982203039 posted

    I am trying to get a rotating caret on a hover over menu, but the caret does not turn. Here is what I am trying:

    .dropdown-menu > li > a:hover:after {
    text-decoration: underline;
    transform: rotate(-90deg);
    }

    <li class="dropdown-submenu">
    <a class="dropdown-item dropdown-toggle" href="http://google.com">Google<b class="caret"></b></a>
    <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Submenu</a></li>
    <li><a class="dropdown-item" href="#">Submenu0</a></li>

    Thursday, June 13, 2019 6:23 PM

Answers

  • User839733648 posted

    Hi Baze72,

    According to your description, I suggest that you could set transform: rotate(-90deg) in the .caret class.

    Here is working demo, and maybe you could refer to.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
        <script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
        <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
        <style>
            .navbar-nav > li.dropdown:hover > a:focus {
                text-decoration: underline;
                
            }
            .navbar-nav > li.dropdown:hover .caret {
                transform: rotate(-90deg);
            }            
                li.dropdown:hover > .dropdown-menu {
                    display: block;
                }
        </style>
    </head>
    <body>
        <div class="collapse navbar-collapse" >
            <ul class="nav navbar-nav">
                <li class="dropdown">
                    <a href="http://google.com" class="dropdown-item dropdown-toggle" data-toggle="dropdown">Google <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a class="dropdown-item" href="#">Submenu1</a></li>
                        <li><a class="dropdown-item" href="#">Submenu2</a></li>
                        <li><a class="dropdown-item" href="#">Submenu3</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </body>
    </html>

    result:

    Best Regards,

    Jenifer

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 14, 2019 2:49 AM