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

              
                <div class="content">
  <h1 class="content-title">Gallery</h1>
  
  <div class="gallery js-gallery">
    <div class="gallery-item">
      <div class="gallery-img-holder js-gallery-popup">
        <img src="https://picsum.photos/600/500" alt="" class="gallery-img">
      </div>
    </div>
    <div class="gallery-item">
      <div class="gallery-img-holder js-gallery-popup">
        <img src="https://picsum.photos/700/500" alt="" class="gallery-img">
      </div>
    </div>
    <div class="gallery-item">
      <div class="gallery-img-holder js-gallery-popup">
        <img src="https://picsum.photos/800/500" alt="" class="gallery-img">
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                html
  background: #F7E4C5
  
.content
  position: relative
  display: block
  width: 100%
  padding: 20px
  
.content-title
  display: block
  margin-bottom: 40px
  font-size: 25px
  line-height: 27px
  font-family: Helvetica, sans-serif
  
.gallery
  position: relative
  display: block
  max-width: 500px
  max-height: 300px
  margin: auto
  border-radius: 4px
  overflow: hidden
  
  .slick-list
    overflow: hidden

  .slick-slide
    outline: none !important
    
.gallery-arrow
  position: absolute
  top: 50%
  transform: translateY(-50%)
  width: 40px
  height: 40px
  font-size: 14px
  font-family: Helvetica, sans-serif
  line-height: 40px
  text-align: center
  background-color: #E6E6E6
  z-index: 10
  cursor: pointer
  transition: background .3s ease
  
  &:hover
    background: #D0DFE6
  
  &.mod-prev
    left: 0
    border-radius: 0 4px 4px 0

  &.mod-next
    right: 0
    border-radius: 4px 0 0 4px
    
  
.gallery-item
  position: relative
  float: left
  vertical-align: middle
  text-align: center
  
.gallery-img-holder
  display: inline-block
  width: auto
  height: auto
  max-width: 500px
  max-height: 500px

.gallery-img
  width: 100%
  height: 100%
  
.slick-lightbox
  
  .slick-arrow
    z-index: 10

              
            
!

JS

              
                $(document).ready(function(){
  $('.js-gallery').slick({
    slidesToShow: 1,
    slidesToScroll: 1,
    prevArrow: '<span class="gallery-arrow mod-prev">Prev</span>',
    nextArrow: '<span class="gallery-arrow mod-next">Next</span>'
  });
  
  $('.js-gallery').slickLightbox({
    src: 'src',
    itemSelector: '.js-gallery-popup img',
    background: 'rgba(0, 0, 0, .7)'
  });
});
              
            
!
999px

Console