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

              
                <div class="header d-flex flex-column align-items-center">
  <h1 class="display-6 mt-3 mb-0">lightGallery</h1>
  <p class="lead mt-2 mb-4">
    lightGallery is a feature-rich, modular JavaScript gallery plugin for
    building beautiful image and video galleries for the web and the mobile
  </p>
  <a class="btn mb-5 btn-outline-primary" href="https://github.com/sachinchoolur/lightGallery" target="_blank">View on GitHub</a>
</div>
<div class="gallery-container d-flex align-items-center justify-content-center" id="gallery-container">
  <a data-lg-size="1280-720" data-pinterest-text="Pin it3" data-tweet-text="lightGallery slide  4" data-src="//www.youtube.com/watch?v=egyIeygdS_E" data-poster="https://img.youtube.com/vi/egyIeygdS_E/maxresdefault.jpg" data-sub-html="<h4>Visual Soundscapes - Mountains | Planet Earth II | BBC America</h4><p>On the heels of Planet Earth II’s record-breaking Emmy nominations, BBC America presents stunning visual soundscapes from the series' amazing habitats.</p>">
    <img class="img-responsive" src="https://img.youtube.com/vi/egyIeygdS_E/maxresdefault.jpg" />
  </a>
  <a data-lg-size="1280-720" data-pinterest-text="Pin it3" data-tweet-text="lightGallery slide  4" data-src="//vimeo.com/112836958?muted=1" data-poster="https://www.lightgalleryjs.com/images/demo/vimeo-video-poster.jpg" data-sub-html="<h4>Nature</h4><p>Video by <a target='_blank' href='https://vimeo.com/charliekaye'>Charlie Kaye</a></p>">
    <img class="img-responsive" src="https://www.lightgalleryjs.com/images/demo/vimeo-video-poster.jpg" />
  </a>
  <a data-lg-size="1280-720" data-pinterest-text="Pin it3" data-tweet-text="lightGallery slide  4" data-src="https://private-sharing.wistia.com/medias/mwhrulrucj" data-poster="https://www.lightgalleryjs.com/images/demo/wistia-video-poster.jpeg" data-sub-html="<h4>Thank You!</h4><p> Sample Wistia video </p>">
    <img class="img-responsive" src="https://www.lightgalleryjs.com/images/demo/wistia-video-poster.jpeg" />
  </a>
  <a data-lg-size="1280-720" data-pinterest-text="Pin it3" data-tweet-text="lightGallery slide  4" data-video='{"source": [{"src":"https://www.lightgalleryjs.com/videos/video1.mp4", "type":"video/mp4"}], "tracks": [{"src": "https://www.lightgalleryjs.com/videos/title.txt", "kind":"captions", "srclang": "en", "label": "English", "default": "true"}], "attributes": {"preload": false, "controls": true}}' data-poster="https://www.lightgalleryjs.com/images/demo/html5-video-poster.jpg" data-sub-html="<h4>'Peck Pocketed' by Kevin Herron | Disney Favorite</h4>">
    <img class="img-responsive" src="https://www.lightgalleryjs.com/images/demo/html5-video-poster.jpg" />
  </a>
</div>
              
            
!

CSS

              
                body {
  padding: 40px;
  background-image: linear-gradient(#e8f0ff 0%, white 52.08%);
  color: #0e3481;
  min-height: 100vh;
}

.header .lead {
  max-width: 620px;
}
.gallery-container a {
  width: 240px;
  margin: 5px;
}

.gallery-container a img {
  max-width: 100%;
  height: auto;
}

              
            
!

JS

              
                import lightGallery from "https://cdn.skypack.dev/lightgallery@2.0.0-beta.3";

import lgVideo from "https://cdn.skypack.dev/lightgallery@2.0.0-beta.3/plugins/video";

lightGallery(document.getElementById("gallery-container"), {
  speed: 500,
  plugins: [lgVideo]
});

              
            
!
999px

Console