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. 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.

+ 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

              
                - var accTitles = {1: 'Collapsible Group Item #1', 2: 'Collapsible Group Item #2', 3: 'Collapsible Group Item #3'}

- var accText = 'Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et.'

mixin loop(id, title)
  div(class="card border-0 rounded-0")
    div(class="card-header p-0" id="heading_"+id)
      h2(class="mb-0 border-bottom")
        button(class="btn btn-link text-white collapsed" type="button" data-toggle="collapse" data-target="#collapse_"+id aria-expanded="false" aria-controls="collapse_"+id)
          = title
          i(class="fa fa-chevron-down")
    div(id="collapse_"+id class="collapse bg-light" aria-labelledby="heading_"+id data-parent="#accordionExample")
      div(class="card-body text-dark")
        | #{accText}

div(class="container d-flex flex-column align-items-center")
  h2(class="text-white text-center mt-5 mb-4") Bootstrap accordion
  p(class="mb-5 text-center text-white")
    | Accordion example using the card component 
    a(class="text-white bg-dark font-weight-bold" href="https://getbootstrap.com/docs/4.5/components/collapse/#accordion-example") bootstrap
  div(class="accordion mb-5" id="accordionExample")
    each val, key in accTitles
      +loop(key, val)
  
  
  
// Please leave your like | Por favor deja tu like
div(class="love")
  | Leave your
              
            
!

CSS

              
                body {
  font-family: var(--font-family-monospace);
  background-image: linear-gradient(to bottom, #a18cd1 0%, #fbc2eb 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}
.accordion {
  width: 100%;
  @media (min-width:991px) { width: 540px; }
  .card-header {
    background-color: var(--purple);
  }
	.btn-link {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;
    padding: 1.125rem 1.5rem;
    &:hover,
    &:focus { text-decoration: none; }
		i {
			transition: all .2s ease;
      &.rotated {
			  transform: rotate(-180deg);
		  }
		}
	}
}



/*
 * Luis Badiali
 * badiali.es
 * Please leave your like | Por favor deja tu like
 */
.love {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: row;
  position: fixed;
  z-index: 1;
  bottom: 1rem;
  left: 1rem;
  padding: 1em;
  font-family: monospace, sans-serif;
  font-size: .875rem;
  line-height: 1em;
  color: #fff;
  background-color: rgba(0,0,0,.3);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  border-radius: 5px;
  &::after {
    content: '❤️';
    margin-left: 10px;
    animation: beat .5s alternate infinite ease-in;
  }
}
@keyframes beat {
  0%   { transform: scale(1); }
  100% { transform: scale(1.2); }
}
              
            
!

JS

              
                $('.collapse').each( function () {
  if ( !$(this).prev().find('.btn').hasClass('collapsed') ) {
    $(this).prev().find('.btn > i').addClass('rotated');
  }
  $(this).on('show.bs.collapse', function () {
    $(this).prev().find('.btn > i').addClass('rotated');
  }).on('hide.bs.collapse', function () {
    $(this).prev().find('.btn > i').removeClass('rotated');
  });
});
              
            
!
999px

Console