+ 1
i want that when i hover in drop (class) then i want to display dropdown(class)......please help me
<!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> .drop-down{ display: none; } .drop:hover .drop-down{ display: block; } </style> </head> <body> <div class="conainer"> <div class="drop"> <ul> <li> part 1</li> <ul> </div> <div class="drop-down"> <ul> <li>test1</li> <li>test1</li> <li>test1</li> <li>test1</li> </ul> </div> </div> </body> </html
8 odpowiedzi
+ 1
Solved check this
https://www.w3schools.com/code/tryit.asp?filename=GLSDLCPRP8L8
+ 3
Abhishek Topno
Please give an MWE
What is MWE?
check the link i have given in my 1st answer.
+ 2
Abhishek Topno
it isn't working because your list is not a child of the drop div
0
Good attempt.
Please follow this link for example:
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_js_dropdown_hover
0
Please can you solve my mistake
0
you could either target sibling elements with '+' operator:
.drop:hover + .drop-down
or with '~' operator:
.drop:hover ~ .drop-down
the first one target only the next sibling element, conversely to the second one wich target all next matching elements with same parent/container...