Design comparison
Solution retrospective
How can I do the functionality that I did with JavaScript with just CSS? (Hide/Show the answer to a question when the question is clicked)
Community feedback
- @markup-mitchellPosted over 3 years ago
Hi @erwinruiz,
This is an Excellent Question which all front end developers should ask themselves constantly!
Have a look at this and see how far it gets you.
There are some limitations in terms of styling IIRC (eg not animatable via CSS), but it's a very good use case.
Keep up the good work!
Marked as helpful0 - @JoseLuisFVPosted over 3 years ago
I used js for this challenge too, but after reading about more pseudo classes, I think use the pseudo class focus maybe is a good approach.
0@erwinruizPosted over 3 years ago@JoseLuisFV Thank you Jose!
I tried with the ':active' pseudo class but it only works when the primary mouse button is pressed.
In a comment above they suggested the <details> tag, you should check it out.
0@JoseLuisFVPosted over 3 years ago@erwinruiz sorry, I tried to say that there is a pseudo class called ":focus", it triggered when you click an element, I'm using it in other challenge, and it works.
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord