Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Request path contains unescaped characters
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

html css flex js

@daKeshra7

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


I couldn't get the arrow to rotate. Please I'll need help on that. Further insights on javascript also needed.

Thank you.

Community feedback

Luka 800

@LukaKobaidze

Posted

Hello!

To rotate arrow, you need to use following CSS property: transform: rotate().

I see that you toggle active class once the element is clicked. Here's the code on how to implement arrow rotate:

.faq-cont.active > .faq-ques > img {
  transform: rotate(180deg);
}

If you aren't familiar with > selector, basically it selects direct child of the element (source). As you can see, class faq-ques is direct child of faq-cont, and img is direct child of faq-ques. If you want to be more specific, you can add class to img and select it with the class.

Marked as helpful

1

@adityas24

Posted

Hey good job!

You can use transform: rotate() property on the arrow and rotate it by 180degree when the arrow is being clicked. You can do this both with css and javascript.

All the best 🙂👍

1
Naveen Gumaste 10,480

@NaveenGumaste

Posted

Hay ! Good Job you made it look nearly perfect to the preview

These below mentioned tricks will help you remove any Accessibility Issues

-> Add Main tag after body like it should be your container

-> For 1st heading or h1 tag, use header tag and then inside the header put your h1 or h2 etc

-> But use header tag only once in main heading element.

-> I see you have a different design from the preview just try to come close to it 😊

Keep up the good work!

1

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