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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                section
  figure
    img(src="https://images.unsplash.com/photo-1523978591478-c753949ff840?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=4a7ae67e32aeafa8fcef6002dc98dc01" alt="Mountains surrounding a body of water")
    figcaption The water was freezing!

  figure
    img(src="https://images.unsplash.com/photo-1504217051514-96afa06398be?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=4c2699a4a22cc550d845fdbc25b676d7" alt="Sun setting over the mountains")
    figcaption The sunset was beautiful that day.

  figure
    img(src="https://images.unsplash.com/photo-1430778643786-afad072a0bb1?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=a2f7f06ab7480af81b66d854ec7cfb90" alt="Countryside with tire tracks in grass")
    figcaption We roamed the countryside and noticed these tracks in the grass. So we followed.
    
  figure
    img(src="https://images.unsplash.com/photo-1448827067615-fa74e848e86c?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=882a9906c73a6e21b7614adfa0080c11" alt="A terrifying close-up of an insect")
    figcaption This was just terrifying. He wasn't that big...

  figure
    img(src="https://images.unsplash.com/photo-1510020553968-30f966e1ec9e?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=b06f39fc12490ec16b4603f87413a9d8" alt="Dog looking out car window")
    figcaption Benson looking pensive as usual.
    
  figure
    img(src="https://images.unsplash.com/photo-1469474968028-56623f02e42e?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=b5d101f72e23afc7e5d667ad09d555ad" alt="Person on mountaintop")
    figcaption We got lost for hours.

  figure
    img(src="https://images.unsplash.com/photo-1520247478381-4d32def223c1?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=8b4f951c5fb787428647e61369f23aa3" alt="Birds eye view of ocean waves")
    figcaption I jumped from the cliffside and plummeted deep into the waves.

  figure
    img(src="https://images.unsplash.com/photo-1507146426996-ef05306b995a?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=8f37819758fae3fecda8434f24eaaea0" alt="A cute golden retriever puppy")
    figcaption We met this cute little guy. Benson was not amused!
    
  figure
    img(src="https://images.unsplash.com/photo-1450045439515-ff27c2f2e6b1?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=97a25f2cb9d2cc37987223a2ca31ad3c" alt="Whale fin emerging from ocean")
    figcaption Whale watching... or were they watching us?
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Sue+Ellen+Francisco');

$spd: 0.6s;
$tf: cubic-bezier(0.645, 0.045, 0.355, 1);

@function rem($pixels, $context: 16) {
  @return #{$pixels/$context}rem;
}

* {
  box-sizing: border-box;
}

body {
  padding: rem(30);
  background-color: whitesmoke;
  font-family: 'Sue Ellen Francisco', serif;
}

section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  grid-auto-rows: 300px;
  grid-gap: rem(30);
  margin: 0 auto;
  max-width: 1000px;
}

figure {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: rem(2);
  transform: translateY(0);
  transition: 
    transform $spd $tf,
    box-shadow $spd $tf;
  
  &:after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    margin: auto;
    width: 100%;
    height: 100%;
    background-color: rgba(crimson, 0.8);
    opacity: 0;
    transition: opacity $spd ease;
  }
  
  &:nth-child(2),
  &:nth-child(4),
  &:nth-child(7) {
    grid-row: span 2;
  }
}

img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translateZ(0);
  transition: transform $spd $tf;
}

figcaption {  
  position: absolute;
  bottom: 0; left: 0;
  padding: rem(24) rem(36) rem(24) rem(18);
  width: 100%;
  color: white;
  font-size: rem(24);
  line-height: 1.2;
  letter-spacing: rem(0.5);
  z-index: 1;
  opacity: 0;
  transform: translateY(-12px) rotate(-3deg);
  transition: 
    opacity $spd $tf,
    transform $spd $tf;
}

// Hover transitions
figure:hover {
  transform: translateY(-6px);
  box-shadow: rgba(black, 0.5) 0 12px 24px -12px;

  &:after {
    opacity: 1;
  }

  img {
    transform: scale(1.05);
  }

  figcaption {
    opacity: 1;
    transform: translateY(0) rotate(-3deg);
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console