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 trialCarlos Serrano
3,351 PointsResponsive menu toggle
Hello everyone. I'm following the CSS Responsive Navigation Menu post from Treehouse's Blog:
http://blog.teamtreehouse.com/create-an-absolute-basic-mobile-css-responsive-navigation-menu
and was wondering how to make the menu display by clicking instead of :hover.
thank you,
2 Answers
Victor Rodriguez
15,015 PointsClick events are really meant for javascript, not for css. onclick(someFunction) for javascript. I don't think there is a :click for css3 actually. However I may be wrong. I do know that you can create a hack by using a hidden checkbox and the :checked selector. but as far as click events go, that is better used for javascript.
Jeremy Williams
9,078 PointsYou could try :active but that will only keep the menu open as long as the mouse button is pressed I believe.
Carlos Serrano
3,351 PointsThank you Jereny
Keith Kelly
21,326 PointsKeith Kelly
21,326 PointsTo expand on what Victor said although you can do somethings with css like animations, it's primary purpose of that language is styling. What you are looking for is a behavior which would be handles with JavaScript.
Each language you use to create web pages serves a specific purpose.
Carlos Serrano
3,351 PointsCarlos Serrano
3,351 PointsThank you Victor and Kelly. I'll start experimenting with JS.