cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              h1 FAQ

// Accessibility pattern:

// place the role of "group" on the details wrapper
// place the role of "button" on the summary, which lets the user know they can interact with the element


details(role="group")
  summary(role="button", aria-expanded="false") <strong>How many fingers am I holding up?</strong>
  p I'm not sure. I can't see your hand.  Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ducimus eius totam sed iusto harum, fuga officia incidunt facere neque obcaecati, amet nihil perspiciatis. Laborum reprehenderit, totam illum ab. Asperiores nobis blanditiis unde saepe praesentium, facere eligendi, voluptatem accusamus odio nulla consequuntur quod sint alias dolores reprehenderit dignissimos earum officia minima vero nesciunt natus sed ad ex iure. Atque nam molestias, dolore alias facere expedita perspiciatis, fuga est, rerum laboriosam nulla unde iste saepe in autem blanditiis quaerat sit? Magni alias eum aliquid esse corrupti amet ex delectus, ab odio neque, eaque, sapiente nulla at distinctio asperiores fugit id maxime! Obcaecati aperiam ullam, vitae quidem eaque possimus, adipisci molestias, debitis iusto accusantium similique, harum neque quia dignissimos voluptatibus repellat qui deleniti.

details(role="group")
  summary(role="button", aria-expanded="false") <strong>What color is the sky?</strong>
  p The sky is blue.
  

            
          
!
            
              body
  font-family: 'Raleway', sans-serif
  text-align: center

  
// the outer wrapper for each faq question and answer
details
  margin: 2rem auto
  width: 75% // controls the width of the outer wrapper
 
  // styles for the answer that is revealed on click
  p
    padding: 2rem 5rem
    line-height: 2
    font-size: .9rem
    text-align: left
    
// controls the question part that is to be clicked
summary
  display: block // required to remove default triangles in Firefox
 
  // hides the default triangle before the summary
  &::-webkit-details-marker
    display: none
  
  // replace the default triangle with a new symbol
  &:before
    display: inline-block // allows rotating the pseudo element
    content: '\203A'
    margin-right: .5rem
    font-weight: bold
    font-size: 1rem
    transition: all 300ms ease // creates animation for rotating marker
  
  // makes element look like a clickable link on hover
  &:hover
    cursor: pointer
  
  
// controls when the details wrapper is in the open, or clicked, state
details[open]
  
  // change question styles
  summary
    color: red // change question color to red
    transition: all 300ms ease // eases the color transition
    
  p
    animation: openDetail 400ms ease // applies animation to answer that is being revealed
    background: #f9f9f9 // preserves background color on open
    
  summary::before
    transform: rotate(90deg) // rotates the arrow before the question
    
 
// animation for the click event
// animated properties: opacity, background, Y position
@keyframes openDetail
  0%
    opacity: 0
    background: white
    transform: translateY(0%)
  50%
    transform: translateY(3%) // half way through, provides a little bounce
  100%
    opacity: 1
    background: #f9f9f9
    transform: translateY(0%) // brings the element back to 0, finishing the bounce effect
            
          
!
999px
Loading ..................

Console