Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 4 years ago

Responsive FQA Accordion Card

Nayana Bhat M•90
@nayanabhatm
A solution to the FAQ accordion card challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hello there!,

  1. How can we maintain the position of the shadow image during resizing the window?
  2. Which one is preferred ? display: none or visibility: hidden?
Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Elaine•11,340
    @elaineleung
    Posted almost 4 years ago

    Hey Nayana, I just completed this challenge also; you can have a look at my repo (https://github.com/elaineleung/frontendmentor/tree/main/accordioncard) and compare the code.

    You can try a few things here:

    1. Use light gray for the divider line in the FAQ (see the HSL color code in the style guide)

    2. Use overflow:hidden to hide the part of the SVG that is sticking out. If you compare the original view in the challenge, you can see that the left corner of the image is actually hidden.

    3. Your desktop views will need to use the desktop version of the images. I see in your CSS that you tried using background-image for the images; that's also what I did, and this is probably the best way since there is a mobile image and a desktop image. One thing that helped me was, I used the browser console to get the exact width and height of the SVGs, and I was able to use those dimensions in my CSS.

    You can try tweaking your solution a bit more, especially in trying to use the desktop version of the image. Good luck!

    Marked as helpful
  • Carlos•1,110
    @Carlos-A-P
    Posted almost 4 years ago

    Hey Nayana,

    • I would maybe try looking into position absolute so that you can group your images together in a wrap div and set the parent element to position relative. This allows you to move the child element around the parent
    • What I did is I used the shadow as a background image in the accordion div to switch between the mobile shadow and desktop shadow. I then used background position: left # top #; to position the image
    • I normally use display: none over visibility hidden. They're both a little different where display:none will hide the element and collapse the space it was taken up. visibility:hidden will hide the element and preserve the elements space
    Marked as helpful

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

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