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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

              <ul class="photo-list">
  <li><a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/cat-nose.jpg"
         title="Close up cat nose">Cat</a></li>
  <li><a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/contrail.jpg"
         title="Passing overhead we sailed into tomorrow">Contrail</a></li>
  <li><a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/drizzle.jpg"
         title="I heard the rain wash the streets">Drizzle</a></li>
  <li><a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/grapes.jpg"
         title="Oh the grapes, they had so much WRATH">Grapes</a></li>
  <li><a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/orange-tree.jpg"
         title="Pluck an orange from the tree">Orange tree</a></li>
  <li><a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/shore.jpg"
         title="Approaching the shoreline, waiting for the tide">Shore</a></li>
  <li><a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/submerged.jpg"
         title="Beneath the waves he could still hear them calling">Submerged</a></li>
  <li><a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/tulip.jpg"
         title="A present from a dewey morning">Tulip</a></li>
  <li><a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/van.jpg"
         title="Get in. I'll explain when we're on the road.">Van</a></li>

<div class="gallery">
  <h2 class="gallery__title">Orange tree</h2>
  <img class="gallery__image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/orange-tree.jpg" />
  <p class="gallery__caption">Pluck an orange from the tree<p>

<p><button class="reset-button">Reset photo</button></p>
              body { font-family: sans-serif; }

.photo-list {
  padding-left: 0;

.photo-list a { color: #05D; }

.photo-list li {
  display: inline-block;
  margin: 0 0.5em;

.photo-list {
  padding: 0;
  display: -webkit-box;
  display: flex;
  flex-wrap: wrap;

.photo-list li {
  display: block;
  margin: 0 0 5px;
  margin-right: -1px;
  text-decoration: none;
  color: #08E;

.photo-list a {
  text-decoration: none;
  display: block;
  padding: 10px;
  border: 1px solid #DDD;
  color: #08E;

.photo-list a:hover {
  background: #EEE;

.gallery__image {
  display: block;
  height: 240px;

button {
  font: inherit;
  padding: 10px 20px;

              $('.photo-list').on( 'click', 'a', function( event ) {
  $('.gallery__image').attr( 'src', $( this ).attr('href') );
  $('.gallery__title').text( $( this ).text() );
  $('.gallery__caption').text( $( this ).attr('title') );

$('.reset-button').on( 'click', function() {
  $('.gallery__image').attr( 'src', 'https://dummyimage.com/240x240/AAA/fff' );
  $('.gallery__title').text( 'Photo title' );
  $('.gallery__caption').text( 'This is the photo caption' );

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................