CleanX
CleanX

Reputation: 1176

Show div upon hover

I want to show a div like a menu upon hovering an text box but for some reason it is not showing up .

Here is my css

     .search:hover  #search_drop {
    display:block;
 }


     #search_drop {
        display:none;
        height:500px;
        width:500px;
        background:#000;
        position:absolute;
        top:0px;
     }

here is the html

     <div id="navigation_s" style="float:left">
       <ul >
         <li > 
           <div class="search">
             <div id="search_drop"> test </div>
              <form action="" id="searchform">
               <input type="text" name="search" id="searchbox" placeholder="looking for something?"/>
               <input type="submit" id="searchbutton" value="go"/>
              </form>
           </div>
         </li>
       </ul>
     </div>

All I want to do is on hovering over search the #search_drop should be shown but it is not happening

Upvotes: 0

Views: 87

Answers (1)

vivek_nk
vivek_nk

Reputation: 1600

You cannot hover on a non-displayed node. display:none -> It is not on your page. So, you cannot hover on this. same applies for hidden But, we can alter other properties. For example,

#search {
 border : 1px green solid;
}
#search:hover {
 border : 5px red solid;
}

<div id="search">
abcdefgh
abcdefgh
abcdefgh
</div>

Upvotes: 1

Related Questions