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

              
                <article>
  <h1 class="sticky-heading">Balloons!</h1>

  <div class="grid">

    <div class="box a"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_1.jpg" alt="Three hot air balloons"></div>

    <div class="box b"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_2.jpg" alt="G-PURP hot air balloon"></div>

    <div class="box c"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_3.jpg" alt="A hot air balloon"></div>

    <div class="box d"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_4.jpg" alt="Several hot air balloons including a Tiptree advertising balloon"></div>

    <div class="box e"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_5.jpg" alt="Several hot air balloons"></div>

    <div class="box f"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_6.jpg" alt="Hot air balloons seen from the air"></div>

    <div class="box g"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_7.jpg" alt="Flying in a hot air balloon"></div>

    <div class="box h"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_8.jpg" alt="Packing a hot air balloon that has landed"></div>

    <div class="box i"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_9.jpg" alt="Dog shaped balloon"></div>

    <div class="box j"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_10.jpg" alt="A colourful balloon"></div>

    <div class="box k"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_11.jpg" alt="Rainbow Ryders balloon"></div>

    <div class="box l"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_12.jpg" alt="A landed balloon with some flying over"></div>

    <div class="box m"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/aea19_13.jpg" alt="Balloons in New Mexico"></div>
  </div>

</article>
              
            
!

CSS

              
                *, *::before, *::after {
    box-sizing: border-box;
 }

 body {
     margin: 0;
     padding: 0;
     font: 1.2em/1.5 Roboto, sans-serif;
 }

 img {
     max-width: 100%;
 }

 .box img {
     height:100%;
     width: 100%;
     object-fit: cover;
 }


.grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(12, 49vh);
    grid-gap: 2vh;
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    height: 100vh;
}

.sticky-heading {
    top: 2vh;
    left: 0;
    background-color: #000;
    color: #fff;
    width: max-content;
    padding: 1rem 1rem 1rem 5vw;
    position: absolute;
}

.a, .c, .e, .g, .i, .k, .m {
  scroll-snap-align: start;
}


@media (min-width: 800px) {
.a, .c, .e, .g, .i, .k, .m {
  scroll-snap-align: none;
}
.grid {
    display: grid;
    grid-gap: 2vh;
    grid-template-columns: 5vw 1fr 1fr 5vw 5vw 1fr 1fr 5vw;
    grid-template-rows: 60vh 38vh 49vh 49vh 49vh 49vh;
    
}

.sticky-heading {
  position: fixed;
}

.a {
    grid-column: 2 / 5; 
    grid-row: 1 ;
    scroll-snap-align: start;
}

.b {
    grid-column: 1 / 3;
    grid-row: 2;
}

.c {
   grid-column: 3 / 5 ;
   grid-row: 2; 
}

.d {
    grid-column: 5 / 9;
    grid-row: 1 / 3;
}

.e {
    grid-column: 1 / 5;
    grid-row: 3;
    scroll-snap-align: start;
    
}

.f {
    grid-column: 1 / 5;
    grid-row: 4;
}

.g {
    grid-column: 5 / 9;
    grid-row: 3 / 5;
}

.h {
    grid-column: 2 ;
    grid-row: 5;
    scroll-snap-align: start;
}

.i {
    grid-column: 3 / 6;
    grid-row: 5;
}

.j {
    grid-column: 6;
    grid-row: 5;
}

.k {
    grid-column: 7 / 9;
    grid-row: 5;
}

.l {
    grid-column: 1 / 5;
    grid-row: 6;
}

.m {
    grid-column: 5 / 9;
    grid-row: 6;
}
}
              
            
!

JS

              
                
              
            
!
999px

Console