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 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.

HTML

              
                <div class="grid">
  <div class="grid__item grid__item--1">
    <a class="card" href="#">
      <div class="card__thumbnail" style="background-image: url(https://ichef.bbci.co.uk/news/660/cpsprodpb/153FF/production/_95593078_gettyimages-660229480.jpg);"></div>
      <article class="card__content">
        <h1 class="card__title">Samsung Galaxy S8's AI helper delayed</h1>
        <span class="card__author">John Doe</span>
      </article>
    </a>
  </div>
  
  <div class="grid__item grid__item--2">
    <a class="card" href="#">
      <div class="card__thumbnail" style="background-image: url(https://ichef-1.bbci.co.uk/news/660/cpsprodpb/A224/production/_95580514_gettyimages-465164406.jpg);"></div>
      <article class="card__content">
        <h1 class="card__title">Microsoft patches serious Word bug</h1>
        <span class="card__author">John Doe</span>
      </article>
    </a>
  </div>
  
  <div class="grid__item grid__item--3">
    <a class="card" href="#">
      <div class="card__thumbnail" style="background-image: url(http://www.swap.ca/img/destinations/uk/swap-uk-splash.jpg);"></div>
      <article class="card__content">
        <h1 class="card__title">Digital map of Britain has stunning views</h1>
        <p class="card__body">Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
        <span class="card__author">John Doe</span>
      </article>
    </a>
  </div>
  
  <div class="grid__item grid__item--4">
    <a class="card" href="#">
      <div class="card__thumbnail" style="background-image: url(https://cdn.images.dailystar.co.uk/dynamic/23/photos/640000/620x/Samsung-Galaxy-S8-568974.jpg);"></div>
      <article class="card__content">
        <h1 class="card__title">First look at Samsung's Galaxy S8 phones</h1>
        <span class="card__author">John Doe</span>
      </article>
    </a>
  </div>
  
  <div class="grid__item grid__item--5">
    <a class="card" href="#">
      <div class="card__thumbnail" style="background-image: url(https://ichef-1.bbci.co.uk/news/660/cpsprodpb/9F9E/production/_95626804_gettyimages-185747019.jpg);"></div>
      <article class="card__content">
        <h1 class="card__title">Eight-year-old borrows car to get food</h1>
        <span class="card__author">John Doe</span>
      </article>
    </a>
  </div>
  
  <div class="grid__item grid__item--6">
    <a class="card" href="#">
      <div class="card__thumbnail" style="background-image: url(http://www.startrek.com/images/TNG.jpg);"></div>
      <article class="card__content">
        <h1 class="card__title">Could Star Trek medicine be a reality?</h1>
        <p class="card__body">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
        <span class="card__author">John Doe</span>
      </article>
    </a>
  </div>
  
  <div class="grid__item grid__item--8">
    <a class="card" href="#">
      <div class="card__thumbnail" style="background-image: url(https://ichef-1.bbci.co.uk/news/660/cpsprodpb/16208/production/_95623609_gettyimages-490597838-1.jpg);"></div>
      <article class="card__content">
        <h1 class="card__title">Tesla CEO Tesla board 'too close to Elon Musk'</h1>
        <span class="card__author">John Doe</span>
      </article>
    </a>
  </div>
</div>
              
            
!

CSS

              
                html {
  background: #f5f7f8;
  font-family: 'Roboto', sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 20px 0;
}

.grid {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  
  display: grid;
  grid-gap: 20px;
  grid-template-columns: 1fr;
  grid-template-rows: auto;
}

.card {
  position: relative;
  top: 0;
  background-color: #fff;
  color: #444;
  text-decoration: none;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: all .3s ease-in-out;
  
  display: flex;
  flex-direction: column;
  min-height: 100%;
  
  &:hover {
    top: -2px;
    box-shadow: 0 4px 5px rgba(0,0,0,0.2);
  }
}

.card__thumbnail {
  padding-bottom: 60%;
  background-size: cover;
  background-position: center center;
}

.card__content {
  padding: 20px;
  flex: 1;
  
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card__title {
  color: #333;
  margin: 0;
  font-size: 20px;
}

.card__author {
  color: #999;
  margin: 2em 0 0 0;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.card__body {
  line-height: 1.5;
  flex: 1;
}

@media (min-width: 600px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .grid__item {
    
    &--1 {
      grid-column: 1/ span 2;
    }
  }
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console