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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                - featured = "https://unsplash.it/600/400/?random"

.container
  .blog-posts 
    .post.featured
      %a{"href"=>"#"}
        .image{"style"=>"background-image: url(#{featured})"}
          .time
            .date 04
            .month APR
        .content  
          %h1 Multiply created make behold fourth yielding living male very god.
          %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas illo tempore at eveniet adipisci harum error deserunt in sint aspernatur magni asperiores explicabo corporis ratione praesentium illum magnam esse ipsa dignissimos quaerat perferendis dolor vero? Maiores hic modi optio eaque...
          .meta
            .icon-comment 22 Comments
            %ul.tags
              %li
              %li
    - (1..3).each do |i|
      .row.cf
        - (1..rand(2) + 2).each do |j|
          .post
            %a{"href"=>"#"}
              .image
                .time
                  .date
                    = rand(30) + 1
                  .month MAR
              .content  
                %h1 Man called gathering us great subdue unto herb sixth forth.
                %p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nam a nostrum nihil nulla hic laborum illum...
                .meta
                  .icon-comment 22 Comments
                  %ul.tags
                    %li
                    %li
              
            
!

CSS

              
                @import "compass/css3";

@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,800|Merriweather:300), 
  url(https://markmurray.co/codepen/customstyle.css);

*, *:before, *:after { @include box-sizing(border-box); }
a, a:visited { display: block; text-decoration: inherit; color: inherit; }

html, body {
  font-family: 'Open Sans', sans-serif;
  font-size: 100%;
  background: darken(#e8eaef, 2%);
}

$blog--height: 200px;

.container {
   padding: 0.5em 1em 1em;
   max-width: calc(1400px + 1em);
   margin: 0 auto;
   overflow: hidden;
  
   .blog-posts {
     
     .featured { width: 100%!important; height: 250px!important; margin: 0.5em 0 1em 0!important; .image { height: 250px!important } .content { height: 250px!important; } }
     
     .row { display: flex; .post { &:last-child{ margin-right: 0!important; } } }
     
      .post {
        //float: left;
        //width: calc(50% - 0.25em);
        flex: 1;
        overflow: hidden;
        background: white;
        height: $blog--height;
        @include box-shadow(0 0 2px 0 rgba(0,0,0,0.2));
        margin-right: 1em;
        margin-bottom: 1em;
        
        &:hover { @include box-shadow(0 0 3px 2px rgba(0,0,0,0.1)); .image { opacity: 0.8 } }
        
        .image, .content { display: inline-block; position: relative;
          @include transition(all 500ms ease);
        }
        
         .image {
           float: left;
           width: 50%;
           height: $blog--height;
           background-size: cover;
           background-position: center center;
           
           .time {
              background: rgba(255,255,255,0.5);
              width: 50px;
              text-align: center;
              padding: 0.5em 0;
              color: #444;
              
              .date {
                 font-weight: bolder; 
              }
             
              .month {
                 font-size: 0.7rem; 
              }
           }
         }
        
         .content {
           padding: 0.5em 1em;
           width: 50%;
           @include box-shadow(-2px 0 2px -1px rgba(0,0,0,0.1));
           height: $blog--height;
           
           &:before {
             content: '';
             position: absolute;
             background: white;
             width: 10px; height: 10px;
             top: 20%;
             left: -5px;
             @include transform(rotate(45deg));
             @include box-shadow(-1px 0 2px -1px rgba(0,0,0,0.1));
           }
           
           h1 { 
              font-weight: 600; 
              line-height: 2;
              white-space: nowrap;
              overflow: hidden; 
              text-overflow: ellipsis;
           }
           
           p {
              font-weight: 300; 
              font-size: 0.7rem;
              line-height: 1.5;
              margin-bottom: 0.5em;
              font-family: 'Merriweather', sans-serif;
           }
           
           .meta {
             .icon-comment {
                font-size: 0.7em; 
                line-height: 2;
                margin-top: auto;
             }
           }
         }
      }
   }
}

[class^="icon-"]:before{ margin-right: 0.5em; color: #3498db; }

img {
   max-width: 100%;
   height: auto;
}

@media screen and (max-width: 840px){
  .row{
    display: block!important;
    
    .post { width: 100%; margin: 0; }
  } 
}

@media screen and (max-width: 600px){ 
  .content { width: 70%!important }
  .image { width: 30%!important }
  
  h1 { text-overflow: inherit; white-space: normal; }
}


/* clearfix */
.cf:before,
.cf:after {
    content: " "; /* 1 */
    display: table; /* 2 */
}

.cf:after {
    clear: both;
}
              
            
!

JS

              
                function rand(min, max) {
  return Math.floor(Math.random() * max) + min;
}

document.querySelectorAll('.post:not(.featured)').forEach((post) => {
  post.querySelector('.image').style.backgroundImage = `url("https://unsplash.it/300/300/?image=${rand(100, 1000)}")`;
});
              
            
!
999px

Console