Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 2 months ago

FAQ accordion -HTML, CSS & JAVASCRIPT

Enes Aliev•330
@Enes-hacker
A solution to the FAQ accordion challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

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?
  1. 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?
Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Harsh Kumar•4,530
    @thisisharsh7
    Posted about 2 months ago

    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:

    1. Centering the Container
      You're using display: 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;
    }
    
    1. Content Scrolling

    Make sure your content do not get cropped on smaller screen height alway set min-height: 100vh on the parent container.

    1. 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•2,060
    @alaa-mekibes
    Posted about 2 months ago

    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 is sans-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!

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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub