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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://use.fontawesome.com/8c01f7817d.js"></script>

<!-- wrapper  -->
<div class="body">
<div class="container">

<!-- header -->

<header class="main-header">
  <i class="fa fa-camera-retro fa-4x logo"></i>
  <h1 class="title">Bootstrap and CSS<span>Transitions</span> Gallery<h1>
</header>

<!-- images row one -->

<div class="row">
  <a href="https://static.pexels.com/photos/111159/pexels-photo-111159-large.jpeg">
    <div class="col-xs-12 col-sm-6 col-md-3">
      <div class="thumbnail">
        <img src="https://static.pexels.com/photos/111159/pexels-photo-111159-large.jpeg" alt="Green coffee cup and saucer filled with a latte">
      <div class="caption">
        <h3>Coffee is awesome.</h3>
        <p>I really really enjoy a nice cup of joe.</p>
      </div>
    </div>
  </div>
</a>
<a href="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/MIFDXUR2VY.jpg">
  <div class="col-xs-12 col-sm-6 col-md-3">
    <div class="thumbnail">
        <img src="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/MIFDXUR2VY.jpg" alt="Various colored umbrellas drifting into the afternoon sky">
        <div class="caption umbrellas">
          <h3>Runaway umbrellas.</h3>
          <p>Umbrellas keep us dry from rain.</p>
        </div>
    </div>
  </div>
</a>
<a href="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/6UHHE19YG7.jpg">
  <div class="col-xs-12 col-sm-6 col-md-3">
    <div class="thumbnail">
      <img src="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/6UHHE19YG7.jpg" alt="Cup of coffee sitting next to Macbook on desk">
      <div class="caption code">
        <h3>Code and coffee.</h3>
        <p>I'm drinking coffee as I code this.</p>
        </div>
    </div>
  </div>
</a>
<a href="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/KGSTJH2CB7.jpg">
  <div class="col-xs-12 col-sm-6 col-md-3">
    <div class="thumbnail">
      <img src="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/KGSTJH2CB7.jpg" alt="Satellite view of Earth">
      <div class="caption canvas">
        <h3>NASA.</h3>
        <p>Thanks for the photo.</p>
        </div>
    </div>
  </div>
  </a>
</div>

<!-- images row two  -->

<div class="row">
  <a href="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/I042LQ5O8H.jpg">
    <div class="col-xs-12 col-sm-6 col-md-3">
      <div class="thumbnail">
        <img src="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/I042LQ5O8H.jpg" alt="Cow standing in field">
      <div class="caption cow">
        <h3>Aw yeah.</h3>
        <p>This cow is a boss.</p>
      </div>
    </div>
  </div>
 </a>
 <a href="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/37O88WH3DD.jpg"> 
  <div class="col-xs-12 col-sm-6 col-md-3">
    <div class="thumbnail">
        <img src="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/37O88WH3DD.jpg" alt="Person using a cup to collect water from river">
        <div class="caption beer">
          <h3>This looks delicious.</h3>
          <p>Really delicious.</p>
        </div>
    </div>
  </div>
 </a>
 <a href="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/TQ44FVSM3Y.jpg">
  <div class="col-xs-12 col-sm-6 col-md-3">
    <div class="thumbnail">
      <img src="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/TQ44FVSM3Y.jpg" alt="Small Italian coupe">
      <div class="caption dog">
        <h3>European cars.</h3>
        <p>Are much smaller than ours.</p>
        </div>
    </div>
  </div>
 </a>
 <a href="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/643FE96E84.jpg">
  <div class="col-xs-12 col-sm-6 col-md-3">
    <div class="thumbnail">
      <img src="https://snap-photos.s3.amazonaws.com/img-thumbs/960w/643FE96E84.jpg" alt="Green bicycle resting on old shed">
      <div class="caption bike">
        <h3>Vintage bikes.</h3>
        <p>Are awesome.</p>
        </div>
    </div>
  </div>
</div>
</a>
</div>
  </div>
            
          
!
            
              .body{
  background: #b8b8b8;
}
.main-header {
  text-align: center;
  margin: 1.5em 0 5em;
  padding: 1em;
  text-indent: 0;
  letter-spacing: 0;
  transition-property: text-indent, letter-spacing,;
  transition-duration: 0.7s;
  transform: scale(1,1);
} 
 .main-header:hover { 
  text-indent: .2rem;
  letter-spacing: .3rem;
  transform: scale(1.3,1.3);
}
.title {
  line-height: .2rem;
}
span {
  font-weight: 900;
}
.caption {
  opacity: 0;
  transition-property: opacity, transform;
  transition-duration: .8s;
}
.caption:hover {
  opacity: 1;
  transform: scale(1.2, 1.2); 
}
.thumbnail {
  position: relative;
}
 .thumbnail img {
  transition: transform .8s;
  transform-origin: 0,0;
}
 .thumbnail:hover img {
  transform: scale(1.2, 1.2);
   overflow: hidden;
}
.caption {
  position: absolute;
  top: 0;
	right: 0;
	bottom: 0; 
	left: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
  background: rgba(0,0,0, .65);
  border: 5px solid #00D180;
}
.umbrellas{
  border: 5px solid #FFB037;
}
.code{
  border: 5px solid #2E2C2D;
}
.canvas {
  border: 5px solid #AD6A3E;
}
.cow {
  border: 5px solid #31490B;
}
.beer {
  border: 5px solid #792002;
}
.dog{
  border: 5px solid #4E68C1;
}
.bike {
  border: 5px solid #4DB74F;
}
.caption h3, 
.caption p {
  color: #fff;
}
#popup {
  background: rgba(0, 0, 0, .7);
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left:0;
  display: none;
}
#popup img {
  margin-left: 30%;
  margin-top: 5%;
  width: 40%;
  border: 5px solid #FFF8DC;
  border-radius: 5%;
}
#popup p {
  text-align: center;
  font-size: 1.5rem;
  line-height: 3rem;
  color: #fff;
}

/* Media Query */
@media (max-width: 768px) {
    .main-header {
    margin: initial;
  }
  .main-header:hover {
  text-indent: .1rem;
  letter-spacing: .1rem;
  transform: scale(1.1,1.1);
}
	.title {
		line-height: initial;
	}
  .thumbnail:hover img {
    transform: scale(1, 1);
  }
  .caption:hover{
    transform: scale(1,1);
  }
}
@media (min-width: 769px) and (max-width: 1040px){
  .main-header:hover {
    text-indent: .1rem;
    letter-spacing: .1rem;
    transform: scale(1.05,1.05);
  }
}
            
          
!
            
              var $popup = $('<div id="popup"></div>');
var $image = $("<img>");
var $caption = $("<p> </p>");

//Append image and caption to popup before we append popup to body
$popup.append($image);
$popup.append($caption);

//Append popup div to html
$("body").append($popup);

// Capture click event on link
$("div a").click(function(event) {
 event.preventDefault();
 var href =  $(this).attr("href");
  
  //Set src as href from link clicked
  $image.attr("src", href);
  $popup.show();
});

//Get alt text to set caption
var captionText = $("div.thumbnail").find("img").attr("alt");
$caption.text(captionText);

//Hide popup when clicked
$popup.click(function() {
  $popup.hide();
});

            
          
!
999px
🕑 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.

Console