Advanved dropdown menu question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Advanved dropdown menu question

I have a menu with some buttons that show the dropdowns on hover. How can I change the style of the buttons when the dropdown is hovered? Btw, I do not use Ids or classes, it. must work with pure selectors.

27th Jun 2018, 5:50 PM
Manuel 48
Manuel 48 - avatar
6 Answers
+ 5
Hello, Manuel 48 ! Please, attach your code, and then people will be able to help you.
27th Jun 2018, 5:52 PM
Alexander Sokolov
Alexander Sokolov - avatar
0
Thanks Alexander Sokolov, but i can't show you the code right now. I just need the selector to select the element right above the original element
27th Jun 2018, 5:56 PM
Manuel 48
Manuel 48 - avatar
0
Hi Manuel 48, Since it's not immediately clear what you mean by "pure selectors", attaching your code is the best thing to do to move forward with this. Your options in HTML are very limited if you're specifically excluding CSS (or JavaScript) as possible solutions.
27th Jun 2018, 8:37 PM
Janningā­
Janningā­ - avatar
0
Also, "right above" could mean parent or sibling, but we can't tell without seeing your code.
27th Jun 2018, 8:39 PM
Janningā­
Janningā­ - avatar
0
Hey Janning, here is a mockup of the structure. <div> <button>On hover, show div in parent</button> <div><! - - On hover, show button right above--> <p>An element...</p> </div> </div>
28th Jun 2018, 5:52 AM
Manuel 48
Manuel 48 - avatar
0
Hi Manuel, I built this on the phone app, so I haven't tested it on a desktop, but it should work. You could probably swap out the p in the CSS tab for div, but it's hard to know which was intended to be the "dropdown". HTML5 has a <nav> element that might be helpful so you can spare the div. https://code.sololearn.com/WsSm7pP40PKq/?ref=app Much faster if you use the Code Playground, by the way. ā˜ŗ Hope this helps! (PS I highly recommend using classes and IDs. Otherwise, you'll run out of pure selectors really fast.)
21st Jul 2018, 11:55 AM
Janningā­
Janningā­ - avatar