Ricky
Ricky

Reputation: 134

Change the property of a class in hover

I want to change css property of a class on hover of another class in css

  #_nav li {
    display:inline;
    text-decoration:none;
    padding-top:5vh;
    line-height:8vh;
    margin-right:5vh;
    cursor:pointer;
    }
   
    #_nav li:hover + #drop{
    color:blue;

    }
    #drop{
         color:red;
         }

when i do hover on

_nav_li

i want color of #drop to get blue

Upvotes: 0

Views: 76

Answers (3)

Suraj Libi
Suraj Libi

Reputation: 515

Remove + before #drop and Try this

#_nav_li:hover #drop {
  color: blue;
}

Upvotes: 1

Dilushika Weerawardhana
Dilushika Weerawardhana

Reputation: 1621

<script>
 $( ".nav" ).hover(
    function() {
       $("#drop").css("color", "blue");
    };
</script>

Upvotes: 0

Muhammad Awais
Muhammad Awais

Reputation: 156

You can try this to change color on hoover

._nav_li:hover #drop{
    color:#DDD;
}

Upvotes: 0

Related Questions