Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <div class="wrapper">
  <header>
    <h2>SingleBox</h2>
    <nav>
      <ul>
        <li>
          <a href="#">Design</a>
        </li>
        <li>
          <a href="#">Code</a>
        </li>
        <li>
          <a href="#">Research</a>
        </li>
      </ul>
    </nav>
  </header>
  <div class="grid-12">
    <div class="article">
      <p>
        Lacinia eget tellus sociis mi ultrices urna diam. Ipsum libero, curabitur aenean leo, dui lacus, tortor ultrices faucibus. Commodo rhoncus sagittis ut tellus rhoncus non nec in viverra. Sit urna eu viverra fermentum hac velit consequat, sagittis accumsan. Pellentesque amet vel, bibendum tortor.
      </p>
      <p>
        <img src="https://source.unsplash.com/700x380/" />
      </p>
      <p>
        Lacinia eget tellus sociis mi ultrices urna diam. Ipsum libero, curabitur aenean leo, dui lacus, tortor ultrices faucibus. Commodo rhoncus sagittis ut tellus rhoncus non nec in viverra. Sit urna eu viverra fermentum hac velit consequat, sagittis accumsan. Pellentesque amet vel, bibendum tortor.
      </p>
    </div>
    <!-- .article -->
    
    <aside class="sidebar">
      <h3>Recent comments</h3>
      <div class="comment">
        <div class="comment__avatar">
          <img src="http://source.unsplash.com/100x100/?portrait" />
        </div>
        <!-- .comment__avatar -->
        <div class="comment__content">
          <div class="comment__content__wrap">
            <div class="comment__content__top">
              <h5 class="comment__content__title">Kuncung</h5>
              <div class="comment__content__time">Yesterday</div>
            </div>
            <!-- .comment__content__top -->
            <p>Vel purus sit tellus morbi at nisl, interdum cursus vestibulum. Eleifend id ut elementum diam arcu elit faucibus dictum eu.</p>
          </div>
          <!-- .comment__wrap -->
        </div>
        <!-- .comment__content -->
      </div>
      <!-- .comment -->
      
      <div class="comment">
        <div class="comment__avatar">
          <img src="http://source.unsplash.com/100x100/?portrait,girl" />
        </div>
        <!-- .comment__avatar -->
        <div class="comment__content">
          <div class="comment__content__wrap">
            <div class="comment__content__top">
              <h5 class="comment__content__title">John</h5>
              <div class="comment__content__time">Feb 2nd, 2020</div>
            </div>
            <!-- .comment__content__top -->
            <p>Vel purus sit tellus morbi at nisl, interdum cursus vestibulum. Eleifend id ut elementum diam arcu elit faucibus dictum eu.</p>
          </div>
          <!-- .comment__wrap -->
        </div>
        <!-- .comment__content -->
      </div>
      <!-- .comment -->
      
      <div class="comment">
        <div class="comment__avatar">
          <img src="http://source.unsplash.com/100x100/?portrait,man" />
        </div>
        <!-- .comment__avatar -->
        <div class="comment__content">
          <div class="comment__content__wrap">
            <div class="comment__content__top">
              <h5 class="comment__content__title">Lucas</h5>
              <div class="comment__content__time">Feb 1st, 2020</div>
            </div>
            <!-- .comment__content__top -->
            <p>Vel purus sit tellus morbi at nisl, interdum cursus vestibulum. Eleifend id ut elementum diam arcu elit faucibus dictum eu.</p>
          </div>
          <!-- .comment__wrap -->
        </div>
        <!-- .comment__content -->
      </div>
      <!-- .comment -->
    </aside>
    <!-- .sidebar -->
  </div>
  <!-- .grid-12 -->
</div>

              
            
!

CSS

              
                :root{
  --f-primary: 'Sarabun', sans-serif;
  --f-secondary: 'Abril Fatface', cursive;
  --c-primary: #081484;
}

body{
  font-family: var(--f-primary);
  background-color: #fafafa;
}

.wrapper{
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
}
h2{
  font-family: var(--f-secondary);
  font-weight: normal;
  color: var(--c-primary);
}
p{
  font-size: 1.125em;
  line-height: 1.5;
  color: rgba(black, 0.85);
  margin: 1.5rem 0; 
}
img{
  max-width: 100%;
}

.grid-12{
  height: 500px;
  display: grid;
  
  //-------------------------
  // 12 is total columns
  // 1fr: flexible length which represents a fraction of the leftover space in the grid container
  // Source: https://www.w3.org/TR/css3-grid-layout/#fr-unit
  //--------------------------
  grid-template-columns: repeat(12, 1fr);
  
  // --------------------------
  // 1.5rem = 24px for gutter.
  // --------------------------
  grid-gap: 1.5rem;
}

header{
  grid-column: span 12;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}
nav{
  ul{
    list-style: none;
    display: inline-flex;
    padding: 0;
    margin: 0;
  }
  li{
    margin-right: 4.5rem;
    &:last-child{
      margin-right: 0;
    }
    a{
      font-size: 0.875em;
      text-transform: uppercase;
      font-weight: 600;
      text-decoration: none;
      color: rgba(black, 0.5);
      letter-spacing: 1px;
      &:hover{
        color: black;
      }
    }
  }
}

.article{
  grid-column: span 6;
}
.sidebar{
  grid-column:  8 / span 5;
  h3{
    grid-column: span 4;
    font-size: 0.875em;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    margin-bottom: 2rem;
  }
}
.comment{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 1.5rem;
  margin-bottom: 1.5rem;
  p{
    font-size: 0.875em;
    margin: 0.5rem 0;
    opacity: 0.7;
    &:last-child{
      margin-bottom: 0;
    }
  }
  &__avatar{
    grid-column: span 1; 
    img{
      max-width: calc(100% - 16px);
      border-radius: 100%;
      border: 8px solid white;
    }
  }
  &__content{
    grid-column: span 3;
    &__wrap{
      background-color: white;
      border: 1px solid rgba(black, 0.1);
      border-radius: 5px;
      padding: 1rem;
    }
    &__top{
      display: flex;
      justify-content: space-between;
      align-items: center;
      h5{
        font-size: 1em;
        font-weight: 500;
      }
    }
    &__title{
      margin: 0;
    }
    &__time{
      font-size: 0.875em;
      color: rgba(black, 0.5);
    }
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console