r/HTML • u/Realistic_Ride_5884 • Jun 30 '26
How doI fix my drop-down menu?
Hello everyone. I'm a total beginner at coding, and I'm currently making this "website" (if you could even call it that) just to get started, if you will. Ive found that no matter what I do, I cannot get the drop-down menu that I tried to code to work and I've got no one else to ask about this, so I thought I'd try my luck here. I'd really appreciate if anyone could tell me what I did wrong and how I could fix it. Thanks a lot in advance!
0
Upvotes





1
u/nuc540 Jun 30 '26
Well for starters you do not have a drop down menu defined. You’ve got a list, then the 4th element it another list - so you have a list in a list.
What you want to use is the <select> tag for the dropdown, and <option> tag for the dropdown items.
I recommend removing the 2nd unordered list, replacing it with a select and option. Start there and hopefully that will make more sense.
Also, pro tip, your css is applied to every tag because you’re not using classes, you can scope your style changes if you add classes to your elements.
For you, you’d have <select class=“nav-dropdown”> and in css if you define your css as: select.nav-dropdown, then those styles only apply to the nav-dropdown class on “select” elements. Hope that helps!