Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

FAQ accordion card solution

Erwin Ruizā€¢ 430

@erwinruiz

Desktop design screenshot for the FAQ accordion card coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

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

Mark Mitchellā€¢ 1,820

@markup-mitchell

Posted

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 helpful

0

Erwin Ruizā€¢ 430

@erwinruiz

Posted

@markup-mitchell Thank you Mark!, I will try it

0

@JoseLuisFV

Posted

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

Erwin Ruizā€¢ 430

@erwinruiz

Posted

@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

@JoseLuisFV

Posted

@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 GitHub
Discord logo

Join 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