Is this drop-down menus HTML/CSS?

Hey guys,

I’m going to attempt this challenge but would like to know if the drop-down menus can only be achieved with JS and if so, why is this? I noticed it’s the same drop down Google uses.

Looking at W3 website of dropdown websites that just use HTML/CSS I can’t see why this would be any different but I can’t see it anywhere.

Cheers

You mean the accordion right?

They need a toggle state, you can’t just use hover. You can do that using CSS only with a checkbox hack. But it’s cleaner with JS.

1 Like

Yes, thank you. I’ll wait until I’ve learned the JS!

I see no reason to wait.

Learning the checkbox hack is good practice even if it isn’t the most optimal solution. It teaches you about sibling selectors and shows some of the limitations of CSS selectors (i.e. what elements you can select depending on where in the DOM you start your selection).

It’s good practice either way.

1 Like

That’s a good point, and I am halfway through the first JS module in FCC.

I feel motivated to try! Thank you.

1 Like

The fCC curriculum doesn’t really have much about DOM manipulation. There is some jQuery stuff but that can all easily be done with plain JS.

Likely all you need to do is toggle a CSS class, which is pretty simple to do.

https://www.youtube.com/results?search_query=dom+manipulation

1 Like

Giving it a look now, thank you!