Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <section id="faq" class="faq">
  <h2 class="faq__header">FAQ</h2>
  <ul class="faq-list">
    <li class="faq-list__item">
      <input id="question1" class="faq-checkbox" type="checkbox">
      <label for="question1" class="faq__question">Question 1
      </label>
      <div class="faq__answer">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pretium gravida libero, non volutpat urna tempus in. Fusce ullamcorper, lorem a semper tristique, diam elit commodo sapien, vel cursus tortor diam nec massa. Morbi porta, tortor at imperdiet tincidunt, nibh diam eleifend massa, et lacinia elit eros at ipsum. Sed ac aliquet massa. Vestibulum id auctor neque. Duis vel elit vel mauris convallis imperdiet non et massa. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi et tellus felis. Sed a urna non justo fermentum cursus id eget metus.

      </div>
    </li>
    <li class="faq-list__item">
      <input id="question2" class="faq-checkbox" type="checkbox">
      <label for="question2" class="faq__question">
        Question 2
      </label>
      <div class="faq__answer">Suspendisse leo lacus, sagittis at blandit eget, porttitor vitae enim. Aliquam eu imperdiet mi. Maecenas porta rutrum magna, ac maximus magna porttitor sit amet. Donec purus quam, fermentum sit amet pulvinar at, sagittis sit amet lorem. Nullam sodales massa in lectus placerat, vel pellentesque dolor bibendum. Sed dapibus dapibus dolor, sit amet facilisis libero. Quisque eu odio turpis. Integer ut enim nibh. Aliquam elementum varius est, eget eleifend dui porttitor sit amet. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

        Cras accumsan, ipsum ut sagittis maximus, odio lorem ullamcorper nisl, auctor auctor nisi lacus nec sem. In vestibulum aliquet metus. Praesent sed congue purus. Curabitur enim mauris, rutrum eu libero eu, aliquet efficitur metus. Vestibulum nulla mi, commodo eget mi at, semper tempus ante. Aliquam eu mattis nisi. Nunc ut hendrerit lectus, ac dignissim velit. Pellentesque luctus orci sit amet metus commodo, a consectetur libero dictum.
      </div>
    </li>
    <li class="faq-list__item">
      <input id="question3" class="faq-checkbox" type="checkbox">
      <label for="question3" class="faq__question">Question 3
      </label>
      <div class="faq__answer">lorem</div>
    </li>
    <li class="faq-list__item">
      <input id="question4" class="faq-checkbox" type="checkbox">
      <label for="question4" class="faq__question">Question 4
      </label>
      <div class="faq__answer">test</div>
    </li>
    <li class="faq-list__item">
      <input id="question5" class="faq-checkbox" type="checkbox">
      <label for="question5" class="faq__question">Question 5
      </label>
      <div class="faq__answer">asdfasdf</div>
    </li>
  </ul>
</section>
              
            
!

CSS

              
                :root{
  --color-black: #000000;
  --color-white: #ffffff;
  --font-weight-normal: 400;
  --font-weight-bold: 700;
}


body{
  background-color: #002040;
  color: #ffffff;
}

.faq{
  max-width: 400px;
  margin: 0 auto;
}

.faq__header{
  font-weight: var(--font-weight-normal);
  text-align: center;
}

.faq-checkbox{
  display: none;
}

.faq-list{
  list-style: none;
  padding: 0;
}

.faq-list__item{
  border-bottom: solid 2px var(--color-white);
}

.faq__question{
  position: relative;
  font-weight: var(--font-weight-bold);
  letter-spacing: 1px;
  display: block;
  cursor: pointer;
  padding: 12px;
}

.faq__question::after{
  content: "";
  width: 20px;
  height: 20px;
  background-color: var(--color-white);
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  clip-path: polygon(50% 80%, 100% 30%, 50% 50%, 0 30%);
}

.faq__answer{
  display: block;
  max-height: 0px;
  font-weight: var(--font-weight-normal);
  margin: 0;
  clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
  transition: max-height .4s ease, clip-path .3s ease, padding-bottom .3s ease;
  padding: 0 12px;
}

.faq-checkbox:checked ~ .faq__answer{
  max-height: 1000px;
  padding-bottom: 12px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.faq-checkbox:checked ~ .faq__question::after{
  transform: scaleY(-1) translateY(50%);
}

              
            
!

JS

              
                
              
            
!
999px

Console