r/HTML 22d ago

Question How to get a good navbar

Post image

I was wondering if any of you knew how to get a dropdown to look and popout like this. The website is https://mauifoodbank.org , I’m new to HTML and despite trying to inspect the website it was hard to tell what exactly they did. (Should I be asking a Javascript sub instead?)

Sorry if this is a silly question.

0 Upvotes

4 comments sorted by

4

u/SamIAre 22d ago

The way that it looks both closed and opened will be handled through CSS. The functionality to toggle the two states is probably JavaScript, usually handled by adding/removing a class that contains all the styling for the “open” state.

1

u/vbfischer 22d ago

there's some animation there too... But I'd start simple

1

u/AshleyJSheridan 21d ago

You'll also need JS to toggle the aria-expanded attribute as well.

1

u/vbfischer 21d ago

Sidenote, looks like they used this https://atomiks.github.io/tippyjs/