Code Monkey home page Code Monkey logo

faq-accordion-card's Introduction

Frontend Mentor - FAQ Accordion Card Solution

This is a solution to the FAQ accordion card challenge on Frontend Mentor.

Table of contents

Overview

The challenge

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
  • Bonus: Complete the challenge without using JavaScript

Screenshot

screenshot

Links

My process

Built with

  • Semantic HTML5 markup
  • Pure HTML functionality: <details></details>
  • CSS Flexbox
  • Pure CSS animations
  • SCSS variables
  • Mobile-first workflow

What I learned

<!-- Adding dropdown functionality in pure HTML -->

<details class="card__detail">
  <summary class="card__detail-summary">
    How many team members can I invite?
    <img
      src="./images/icon-arrow-down.svg"
      alt="orange arrow"
      class="card__detail-summary--img"
    />
  </summary>
  <p class="card__detail-text">
    You can invite up to 2 additional users on the Free plan. There is no limit
    on team members for the Premium plan.
  </p>
</details>
/* Animationg the same dropdown with some simple transitions */

.card__detail {
  &:not([open]) {
    height: 3.5em;
  }

  &[open] {
    color: $color-primary;
    height: 7em;
    transition: all 0.5s ease-out;

    & .card__detail-summary {
      font-weight: 700;
    }

    & .card__detail-summary--img {
      transform: rotate(180deg);
    }
  }
}

Useful resources

Author

faq-accordion-card's People

Contributors

kens-visuals avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.