Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="app">
   <div class="app__head">
      <h1>Questions and answers about login</h1>
   </div>
   <div class="app__content">
      <div class="accordion-container">
         <div class="accordion ">
            <header class="accordion__header">
               <p>
                  <button>
                     <span class="accordion__title">Do I have to allow the use of cookies?</span>
                     <div class="accordion__icon">
                        <svg class="icon__plus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path d="M8 8h24v24H8z" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M20 13v14m-7-7h14" />
                           </g>
                        </svg>
                        <svg class="icon__minus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.929" d="M11 19.5h18" />
                           </g>
                        </svg>
                     </div>
                  </button>
               </p>
            </header>
            <div class="accordion__content">
               <div class="accordion__inner">
                  <p>
                     Yes, in order to use My Page, you must allow the use of cookies in
                     your browser.
                     <p>
                        See also: What is a cookie and what does it do?
                     </p>
                  </p>
               </div>
            </div>
         </div>
         <div class="accordion">
            <header class="accordion__header">
               <p>
                  <button>
                     <span class="accordion__title">How do I change my My Page Password?</span>
                     <div class="accordion__icon">
                        <svg class="icon__plus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path d="M8 8h24v24H8z" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M20 13v14m-7-7h14" />
                           </g>
                        </svg>
                        <svg class="icon__minus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.929" d="M11 19.5h18" />
                           </g>
                        </svg>
                     </div>
                  </button>
               </p>
            </header>
            <div class="accordion__content ">
               <div class="accordion__inner">
                  <p>
                     Get to setting > password and change your old password then click save button
                  </p>
               </div>
            </div>
         </div>
         <div class="accordion">
            <header class="accordion__header">
               <p>
                  <button>
                     <span class="accordion__title">What is BankID?</span>
                     <div class="accordion__icon">
                        <svg class="icon__plus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path d="M8 8h24v24H8z" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M20 13v14m-7-7h14" />
                           </g>
                        </svg>
                        <svg class="icon__minus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.929" d="M11 19.5h18" />
                           </g>
                        </svg>
                     </div>
                  </button>
               </p>
            </header>
            <div class="accordion__content">
               <div class="accordion__inner">
                  <p>
                     The BankID is your number account id used to login
                  </p>
               </div>
            </div>
         </div>
         <div class="accordion">
            <header class="accordion__header">
               <p>
                  <button>
                     <span class="accordion__title">Whose birth number can I use?</span>
                     <div class="accordion__icon">
                        <svg class="icon__plus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path d="M8 8h24v24H8z" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M20 13v14m-7-7h14" />
                           </g>
                        </svg>
                        <svg class="icon__minus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.929" d="M11 19.5h18" />
                           </g>
                        </svg>
                     </div>
                  </button>
               </p>
            </header>
            <div class="accordion__content">
               <div class="accordion__inner">
                  <p>
                     You can choose from numbers and letters.
                     Must be 8 characters long !
                  </p>
               </div>
            </div>
         </div>
         <div class="accordion">
            <header class="accordion__header">
               <p>
                  <button>
                     <span class="accordion__title">When do I receive a password ordered by letter?</span>
                     <div class="accordion__icon">
                        <svg class="icon__plus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path d="M8 8h24v24H8z" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M20 13v14m-7-7h14" />
                           </g>
                        </svg>
                        <svg class="icon__minus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.929" d="M11 19.5h18" />
                           </g>
                        </svg>
                     </div>
                  </button>
               </p>
            </header>
            <div class="accordion__content">
               <div class="accordion__inner">
                  <p>
                     You will receive a new password after your registration !

                  </p>
               </div>
            </div>
         </div>
         <div class="accordion">
            <header class="accordion__header">
               <p>
                  <button>
                     <span class="accordion__title">What do I have to do to receive a password via SMS?</span>
                     <div class="accordion__icon">
                        <svg class="icon__plus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path d="M8 8h24v24H8z" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M20 13v14m-7-7h14" />
                           </g>
                        </svg>
                        <svg class="icon__minus" xmlns="http://www.w3.org/2000/svg" width="40" height="40">
                           <g fill="none" fill-rule="evenodd">
                              <circle cx="20" cy="20" r="20" fill="#E5DDE7" opacity=".497" />
                              <path stroke="#DC094E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.929" d="M11 19.5h18" />
                           </g>
                        </svg>
                     </div>
                  </button>
               </p>
            </header>
            <div class="accordion__content">
               <div class="accordion__inner">
                  <p>
                     You need to have a valid phone number in your account!
                  </p>
               </div>
            </div>
         </div>

      </div>
   </div>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Mulish:wght@400;700&display=swap");
:root {
   --clr-head: hsl(246, 35%, 11%);
   --clr-body: hsl(248, 35%, 11%);

   box-sizing: border-box;
}
*,
*::before,
*::after {
   margin: 0;
   padding: 0;
   box-sizing: inherit;
}

html {
   width: 100%;
   height: 100%;
   font-size: 62.5%;
}

body {
   font-family: "Mulish", sans-serif;
   width: 100%;
   height: 100vh;
   font-size: 1.6rem;
   color: var(--clr-body);
   display: flex;
   align-items: center;
   justify-content: center;
   background-color: hsl(291, 62%, 22%);
}

.app {
   max-width: 66em;
   width: 100%;
   background-color: white;
   border-radius: 10px;
   position: relative;
   padding: 3em;
   display: grid;
   grid-template-columns: 0.8fr 1fr;
   gap: 2rem;
}

.app::before {
   content: "";
   position: absolute;
   top: -8rem;
   left: -8rem;
   width: 206px;
   height: 206px;
   background-color: hsl(340, 57%, 45%);
   z-index: -1;
}

.app::after {
   content: "";
   position: absolute;
   bottom: -8rem;
   right: -8rem;
   width: 206px;
   height: 206px;
   background: transparent;
   border-right: 3.5rem solid hsl(340, 57%, 45%);
   border-bottom: 3.5rem solid hsl(340, 57%, 45%);
   z-index: -1;
}

.app__head {
   margin-top: 2em;
}
.app__head h1 {
   font-size: clamp(3rem, 5vw, 3.6rem);
   font-weight: 700;
   width: 80%;
   line-height: 1.2;
}

.accordion {
   margin-bottom: 0.5em;
   max-width: 588px;
   border-radius: 3px;
   width: 100%;
   border: 1px solid hsla(0, 0%, 90%, 1);
   cursor: pointer;
}

.accordion.is-open {
   box-shadow: 0 18px 20px -10px hsla(291, 62%, 22%, 0.32);
   border-radius: 3px;
}

.accordion__header button {
   display: flex;
   align-items: center;
   justify-content: space-between;
   width: 100%;
   border: 0;
   background-color: #fff;
   padding: 2em;
   text-align: left;
   outline: none;
}

.accordion__title {
   font-size: 1.8rem;
   /* font-size: clamp(); */
   font-weight: 400;
}

.accordion__icon {
   cursor: pointer;
}

.accordion .accordions__icon > * {
   width: 4rem;
}
.accordion .icon__plus {
   display: block;
}

.icon__minus {
   display: none;
}

.accordion.is-open .icon__minus {
   display: block;
}

.accordion.is-open .icon__plus {
   display: none;
}

.accordion__content {
   height: 0;
   overflow: hidden;
   transition: height 0.3s ease-out;
}

.accordion__inner {
   max-width: 80%;
   width: 100%;
   padding: 1em 1.5em;
}

.accordion__inner p {
   font-size: 1.6rem;
   line-height: 1.4;
   margin-bottom: 1em;
   color: var(--clr-body);
   opacity: 0.7;
}

@media (max-width: 768px) {
   .app {
      max-width: 90%;
      margin: 0 auto;
      display: grid;
      grid-template-columns: 1fr;
      gap: 3rem;
   }
   .app__head h1 {
      width: 90%;
   }

   .app::before {
      display: none;
   }

   .app::after {
      display: none;
   }
}

              
            
!

JS

              
                // Design by https://uidesigndaily.com/posts/sketch-accordion-website-day-1175

const accordionContainer = document.querySelector(".accordion-container");

// select accordion header
accordionContainer.addEventListener("click", (e) => {
   const accordionHeader = e.target.closest(".accordion__header");

   if (accordionHeader) {
      const accordion = accordionHeader.parentElement;
      const accordionContent = accordionHeader.nextElementSibling;
      const accordionInner = accordionContent.children[0];

      let height;

      if (accordion.classList.contains("is-open")) {
         height = 0;
      } else {
         height = accordionInner.getBoundingClientRect().height;
      }

      accordion.classList.toggle("is-open");
      accordionContent.style.height = `${height}px`;
   }
});

              
            
!
999px

Console