+ 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.
6 Antworten
+ 5
Hello, Manuel 48 !
Please, attach your code, and then people will be able to help you.
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
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.
0
Also, "right above" could mean parent or sibling, but we can't tell without seeing your code.
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>
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.)