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

              
                header  
  nav.navigation
    .logotype NewsApp
    ul.categories
      li.category-item
        a(href="#") Sports
      li.category-item
        a(href="#") Tech
      li.category-item
        a(href="#") Books
      li.category-item
        a(href="#") Art

  .search
    input(type="search" placeholder="Type to search...")
      
.wrapper
  aside.sidebar
    ul.sidebar-list
      li.sidebar-item
        i.fa.fa-newspaper-o
      li.sidebar-item.sb-active
        i.fa.fa-th
      li.sidebar-item
        i.fa.fa-picture-o
      li.sidebar-item
        i.fa.fa-bell-o
      li.sidebar-item
        i.fa.fa-bolt
      
  main.content
    .feed-grid
      .card-half.wide
        .card-img
          span.label 
            i.fa.fa-star
          img(src="http://a5.files.airows.com/image/upload/c_fit,cs_srgb,w_620/MTM0MjY4NjM0MzY4NTY5MzE0.png", alt="img")
        .card-text
          h4 All outdoor & adventure lovers should follow this guy on instagram
          p Just take a look at a few of his shots and try not to want this in your feed regularly.
        ul.card-tools
          li.tools-item
            i.fa.fa-heart.like
            span.tools-count 543
          li.tools-item
            i.fa.fa-share.share

      .card 
        img(src="https://40.media.tumblr.com/027d3fdde45d8cb950a74dd070cf8e90/tumblr_nxfo8rG3o81qzleu4_og_540.jpg", alt="img")
        .info-center 12 Photos Of A Gorgeously Designed NYC Home
      .card
        img(src="https://36.media.tumblr.com/1a6bf1c955f5278517f71d50b60ac89d/tumblr_nw46p7NOHH1qkegsbo2_540.jpg", alt="img")
        .info-center Beautiful Yet Simple Warehouse-Inspired Home

      .card
        img(src="https://41.media.tumblr.com/38033666a5ce5c84a658fd90409f8467/tumblr_nxcmsxVSHs1qkegsbo1_540.jpg", alt="img")
        .info-center Top trends this winter 2016

      .card-half.wide
        .card-img
          img(src="https://40.media.tumblr.com/tumblr_lzgmkfRJ7U1qb899go1_500.jpg", alt="img")
        .card-text
          h4 History travel to Spain. Photos stunning country
          p Just take a look at a few of his shots and try not to want this in your feed regularly.
        ul.card-tools
          li.tools-item
            i.fa.fa-heart.like
            span.tools-count 133
          li.tools-item
            i.fa.fa-share.share
      .card-half
        .card-img
          img(src="https://www.chelseafc.com/content/cfc/en/homepage/news/boilerplate-config/latest-news/2015/11/pre-match-briefing--stoke-city-v-chelsea--part-two/_jcr_content.autoteaser.jpeg", alt="img")
        .card-text
          h4 Pre-Match Briefing: Stoke City v Chelsea
          p We have a tea-time appointment in the Potteries later today.
        ul.card-tools
          li.tools-item
            i.fa.fa-heart.like
            span.tools-count 4533
          li.tools-item
            i.fa.fa-share.share
      .card 
        img(src="https://41.media.tumblr.com/7be0a9c6035a5eaaafaddab95a3d77ae/tumblr_mmp17zInpt1qhfgjbo1_540.jpg", alt="img")
        .info-center Best 100 memorable sports photos
      .card
        img(src="https://cdn-images-1.medium.com/max/600/1*wFiuAFruqIUTNU99xpb_zw.gif", alt="img")
        .info-center Long shadow is dead. Welcome Diffuse shadows.
      .card 
        img(src="https://40.media.tumblr.com/027d3fdde45d8cb950a74dd070cf8e90/tumblr_nxfo8rG3o81qzleu4_og_540.jpg", alt="img")
        .info-center 12 Photos Of A Gorgeously Designed NYC Home
      .card
        img(src="https://40.media.tumblr.com/214255d33d16e6075d674c9cd84d9a6c/tumblr_no7630It9v1qd6rjmo1_540.jpg", alt="img")
        .info-center Christina Schneiderlin: Interview with the artist
      .card-half
        .card-img
          span.label 
            i.fa.fa-star
          img(src="https://40.media.tumblr.com/682b6eb0bcafb090c26cda164a235f3b/tumblr_n04czvggDF1sv6eyto1_500.jpg", alt="img")
        .card-text
          h4 You just should run
          p Learn how to run can improve your health.
        ul.card-tools
          li.tools-item
            i.fa.fa-heart.like
            span.tools-count 8543
          li.tools-item
            i.fa.fa-share.share
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Raleway:400,500,600,700,300);

$grey      : #e6e6e6;
$midnight  : #1f282f;
$white     : #ffffff;
$nav-color : $white;
$blue      : #2196f3;
$red       : #df2324;
$yellow    : #fdd701;

@mixin transition($prop, $time) {
  transition: $prop $time ease;
}

* {
  box-sizing: border-box;
}

a {
  text-decoration: none;
  color: black;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: "Raleway", sans-serif;
  font-size: 14px;
}

.wrapper {
  display: flex;
  background-color: pink;

  flex-grow: 1;
}

header {
  display: flex;
  height: 65px;
  background-color: $nav-color;

  align-items: center;
  justify-content: space-between;
}

.sidebar {
  min-width: 120px;
  background-color: $midnight;
}

.sidebar-list {
  display: flex;
  margin-top: 30px;

  flex-flow: column wrap;
  align-items: center;
  justify-content: center;
}

.sidebar-item {
  margin-top: 25px;
  cursor: pointer;
  color: #3a3d46;
  font-size: 24px;

  @include transition(color, 200ms);
  &:hover {
    color: $white;
  }
}

.sb-active {
  color: $white;
}

.content {
  width: 100%;
  padding: 50px;
  background-color: $grey;
}

.feed-grid {
  display: flex;
  max-width: 1170px;
  margin: 0 auto;

  flex-flow: row wrap;
  justify-content: center;
  align-content: flex-start;
}

.navigation {
  display: flex;

  align-items: center;
}

.logotype {
  display: flex;
  width: 120px;
  min-width: 120px;
  height: 65px;
  color: $white;
  background-color: $blue;
  font-weight: bold;

  align-items: center;
  justify-content: center;
}

input[type="search"] {
  display: flex;
  width: 300px;
  height: 15px;
  margin-right: 20px;
  padding: 10px;
  border: 1px solid $grey;
  border-radius: 5px;
  outline: none;
  font-size: 12px;

  justify-content: flex-end;
}

.categories {
  display: flex;
  margin-left: 45px;
}

.category-item {
  margin: 0 10px;
}

%img-placeholder {
  background-position: center;
  background-size: cover;
}

.card {
  position: relative;
  width: 320px;
  height: 320px;
  margin: 7px;
  background-color: $white;
  box-shadow: 0px 0px 10px 0px rgba(110,123,140,0.3);

  flex: auto;
  img {
    width: 100%;
    height: 100%;

    object-fit: cover;
  }
  &:nth-child(5) {
    flex: 545px;
  }
}

.card-half {
  display: flex;
  width: 320px;
  height: 320px;
  margin: 7px;
  background-color: $white;
  box-shadow: 0px 0px 10px 0px rgba(110,123,140,0.3);

  flex-flow: column wrap;
  justify-content: flex-end;
  flex: auto;
}

.wide {
  width: 480px;
}

.card-img {
  position: relative;
  height: 160px;

  flex: auto;
  img {
    width: 100%;
    height: 100%;

    object-fit: cover;
  }
}

.label {
  position: absolute;
  top: 20px;
  right: 20px;
  color: $yellow;
  font-size: 20px;
}

.card-text {
  padding: 0 20px;
  p {
    margin: 0;
    padding: 0;
    color: #888888;
  }
}

.card-tools {
  display: flex;
  height: 50px;
  padding: 15px 20px;

  flex-flow: row wrap;
  align-items: flex-end;
}

.tools-item {
  margin-right: 20px;
  cursor: pointer;

  @include transition(opacity, 200ms);
  &:hover {
    opacity: 0.7;
  }
}

.tools-count {
  padding: 0 5px;
  color: #888888;
  font-size: 14px;
}
.share {
  color: #333333;
}

.like {
  color: $red;
}
.info-center {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  padding: 0 10px;
  text-align: center;
  color: white;
  background: rgba(0, 0, 0, 0.3);
  text-shadow: 1px 1px 10px rgba(0, 0, 0, 0.2);
  font-size: 24px;
  font-weight: bold;

  justify-content: center;
  align-items: center;
}

              
            
!

JS

              
                /* https://dribbble.com/shots/2339347-Grid-with-CSS-Flexbox-Codepen */
              
            
!
999px

Console