re: The Web I Want VIEW POST


As a back end developer who is trying to learn front end development this caught my eye. I'm curious how you would accomplish things like drop-down menus that "mobile first" sites have these days. At this point in my journey I'm not aware of any way to take action on a click other than JavaScript (form submit and links aside of course).


The HTML Select Element is all that is needed. No JS required.



A lot of drop-down menus do suck a fair bit on mobile, so tread with caution. If you do need JavaScript how will users without JavaScript use your site? Maybe a drop-down menu isn't the way.

Let's imagine you're set on having a dropdown menu anyway!

I don't know a way how to do it without JS either (that's not to say there isn't a way) so in your case I'd write a little Javascript.

Just to be clear, a lot of people are misinterpreting me (or miscommunication on my part) in saying never use javascript. Feel free to use it, if it's really needed and think about the consequences of it.

Overall my main objection is to large amounts of javascript ruining perfectly good content for lots of users when it wasn't really needed in the first place.


You can do dropdowns with CSS transformations. Wish I had a good example, but the app I'm doing now is behind a login.

Sounds like an excellent idea for a post here :)

I'm thinking about it, but I'm not yet convinced I wouldn't just be repeating something posted elsewhere. Looking around though, it looks like I combined approaches that I found in other posts, so it might be worthwhile.

code of conduct - report abuse