Skip to content

A responsive FAQ Accordion Card with interactive question toggling, built using HTML, LESS, and JavaScript. Features a mobile-friendly design with smooth transitions and hover effects. ๐Ÿš€

License

Notifications You must be signed in to change notification settings

Yashi-Singh-9/FAQ-Accordion-Card

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Frontend Mentor - FAQ Accordion Card Solution

This is a solution to the FAQ Accordion Card Challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building real-world projects.

๐Ÿ“‘ Table of Contents


๐Ÿ“ Overview

๐ŸŽฏ The Challenge

Users should be able to:

  • View the optimal layout depending on their device's screen size.
  • See hover states for all interactive elements.
  • Expand/collapse answers when clicking a question.

๐Ÿ“ธ Screenshot

Desktop Design

FAQ Accordion Screenshot

Mobile Design

๐Ÿ”— Links


โš™๏ธ Installation & Setup

1๏ธโƒฃ Install LESS Compiler

Since this project uses LESS for styling, you'll need to compile it into standard CSS.

๐Ÿ”น Option 1: Using Node.js (Recommended)

  1. Install Node.js if you haven't already.
  2. Open the terminal and install LESS globally:
    npm install -g less
  3. Navigate to the project directory and compile the LESS file:
    lessc style.less style.css
  4. Open index.html in your browser.

๐Ÿ”น Option 2: Using Live LESS Compiler (VS Code)

  1. Install the Live LESS Compiler extension from the VS Code marketplace.
  2. Open your project in VS Code.
  3. Click the "Watch LESS" button at the bottom of the editor.
  4. The compiler will automatically generate a style.css file from style.less.

๐Ÿš€ My Process

๐Ÿ—๏ธ Built With

  • Semantic HTML5 markup
  • LESS (CSS Preprocessor)
  • CSS Flexbox & Grid
  • Vanilla JavaScript (ES6+)
  • Mobile-first workflow

๐Ÿ“š What I Learned

While working on this challenge, I improved my understanding of:

  1. LESS Nesting & Variables:

    @soft-red: hsl(14, 88%, 65%);
    
    .accordion-button {
        color: @soft-red;
        &:hover {
            font-weight: bold;
            color: darken(@soft-red, 10%);
        }
    }
  2. JavaScript Accordion Functionality:

    document.querySelectorAll(".accordion-header").forEach(header => {
        header.addEventListener("click", function () {
            this.classList.toggle("active");
            this.nextElementSibling.style.display = 
                this.classList.contains("active") ? "block" : "none";
        });
    });

๐Ÿ”ฎ Continued Development

  • Improve ARIA accessibility for screen readers.
  • Convert project to React with dynamic FAQ items.
  • Use GSAP animations for smooth transitions.

๐Ÿ”— Useful Resources


โœ๏ธ Author


๐ŸŽ–๏ธ Acknowledgments

Big thanks to Frontend Mentor for providing awesome coding challenges! ๐Ÿ’™

About

A responsive FAQ Accordion Card with interactive question toggling, built using HTML, LESS, and JavaScript. Features a mobile-friendly design with smooth transitions and hover effects. ๐Ÿš€

Topics

Resources

License

Stars

Watchers

Forks