Skip to content

Solution to the FAQ accordion card challenge on Frontend Mentor | Solução para o desafio do cartão de perguntas frequentes no Frontend Mentor

Notifications You must be signed in to change notification settings

andrebdasilva/faq-accordion-card-main

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - FAQ accordion card solution

In portuguese

This is a solution to the FAQ accordion card challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • View the optimal layout for the component depending on their device's screen size
  • See hover states for all interactive elements on the page
  • Hide/Show the answer to a question when the question is clicked

Screenshot

Desktop 1920px

Mobile 375px

My process

Built with

  • Semantic HTML5 markup
  • CSS variables
  • CSS with adjacent selectors
  • Responsive layout
  • Interaction with pure JavaScript

What I learned

I learned to use adjacent selectors in CSS to add actions to the question container and the answer container, using just an "active" class.
And in javascript use only the "active" class to do all the accordion interactivity.

CSS Class e adjacent selector

.active{
	font-weight: 700;
}

.active::after{
	transform: rotate(180deg);
}

.container-question.active + .container-answer{
	max-height: 8rem;
	padding: 0 0 1rem 0;
	border-bottom: .063rem solid var(--divires-color-light-grayish-blue);
}

Author

Acknowledgments

  • Thank you all from the Frontend Mentor

About

Solution to the FAQ accordion card challenge on Frontend Mentor | Solução para o desafio do cartão de perguntas frequentes no Frontend Mentor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published