Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Drop Down

How to make our own drop-down menu looks like bootstrap with HTML and CSS

1 Answer

According to Bootstrap's documentation, their dropdown menus intentionally open on click instead of on hover and use the Popper.js library; https://getbootstrap.com/docs/4.0/components/dropdowns/

So if you want the same effect without the rest of Bootstrap, adding Popper.js into your project is the way to go.

If you just want to get started with dropdowns using only CSS and no JS (and not necessarily the bootstrap way): a good place to start is by setting your dropdown menu's ul to display:none; then on :hover to display:block; . Then position the dropdown menus with position: absolute; and translate the element using top/bottom/left/right css properties.