FAQ accordion -HTML, CSS & JAVASCRIPT

Solution retrospective
Everything worked as expected. I used background-image for both laptop and mobile resolution it was perfect. I learned how to code an FAQ section. It would be a great reference for my future projects
What challenges did you encounter, and how did you overcome them?Centering the FAQ container so it aligns with the image design
What specific areas of your project would you like help with?- centering the FAQ Container so it aligns with the design well 2.with the code structure(clean code or better practices) and 3.font-family, why my "Q" letter from FAQs is different from the design?
Please log in to post a comment
Log in with GitHubCommunity feedback
- @thisisharsh7
Great work on the FAQ Accordion challenge! Here's your review:
✅ What You Did Well:
- Semantic HTML: Good use of headings and structure for accessibility.
- Responsive Background: Your media query setup for background images works perfectly.
- Accordion Functionality: Smooth transitions and logic in the JS to toggle the answers.
- Styling: Nice layout and spacing — the component is visually clean and readable.
🔧 Suggestions for Improvement:
- Centering the Container
You're usingdisplay: flex
on the<body>
, which is great. However, also ensure no extra margin/padding on the body or parent containers that could misalign the section. You could try:
body { margin: 0; padding: 1rem; box-sizing: border-box; }
- Content Scrolling
Make sure your content do not get
cropped
on smaller screen height alway setmin-height: 100vh
on the parent container.- Font Consistency (Regarding the "Q" Shape)
If the "Q" looks different from the design, make sure you're using the correct weight and that the Work Sans font is properly imported via Google Fonts or a local file. Also, check font-weight:
h1 { font-family: 'Work Sans', sans-serif; font-weight: 700; /* or whatever matches the design */ }
Overall, solid job — just a few tweaks for polish and best practices!
- @alaa-mekibes
Good job! I like your page; it’s very smooth.
- The issue with your Q is that you don’t import the font using
@font-face
or a link in the HTML. The actual font issans-serif
. So if you want to use first method:
@font-face { font-family: 'WorkSans'; font-weight: 400; src: url('../fonts/WorkSans-Regular.ttf') format("truetype"); } @font-face { font-family: 'WorkSans'; font-weight: 600; src: url('../fonts/WorkSans-SemiBold.ttf') format("truetype"); } @font-face { font-family: 'WorkSans'; font-weight: 700; src: url('../fonts/WorkSans-Bold.ttf') format("truetype"); }
You're doing an exceptional job, keep striving for greatness!
- The issue with your Q is that you don’t import the font using
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