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.
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
- Solution URL: https://github.com/webdevbynight/faq-accordion-card-main
- Live Site URL: https://webdevbynight.github.io/faq-accordion-card-main/
- Semantic HTML5 markup
- CSS (via SCSS)
- custom properties
- pseudo-classes
- pseudo-elements
- CSS sprite
- Mobile-first workflow
I learned how to show and hide the answers of the questions without using any line of JavaScript.
Safari is buggy when using a pseudo-element with a height defined at 100%: when opening an answer, the container does not fit its new calculated height.
Even if I did not feel I spent too much time carrying out this challenge, I still have to learn about how to make front-end development in a more efficient way and to learn to manage to build web pages without seeming to be too slow.
- The “Interactive elements” section from the HTML 5 specification - This helped me to learn about the
details
andsummary
elements and theopen
attribute. - Can I use… HTML element: summary:
display: list-item
- This helped me about browsers compatibility of the use ofdisplay: list-item
(and therefore of thelist-style-*
properties) on thesummary
element. - Quick Reminder that Details/Summary is the Easiest Way Ever to Make an Accordion - This article helped me to find an excellent solution to carry out the challenge, including its bonus (i.e. to make an accordion without JavaScript).
- Two Issues Styling the Details Element and How to Solve Them - This article helped me about some issues when styling a
details
element. - Personnaliser le marqueur de révélation - This section of article (in French) gives a tip to customise the disclosure widget on Safari, which does not support the standard way of customising it (at the time when I wrote these lines, the issue concerned Safari 16.4 and lower versions).
- Website - @webdevbynight
- Frontend Mentor - @webdevbynight