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

              
                <article class="card card--featured">
  <figure class="card__figure">
    <img class="card__image" src="https://picsum.photos/id/66/500/500" alt="Example picture" />
  </figure>
  <div class="card__content card__content--featured">
    <h1 class="card__title card__title--featured"><small class="card__topic">Featured news</small>Big news of the day with a featured title</h1>
  </div>
</article>

<article class="card card--news">
  <figure class="card__figure">
    <img class="card__image" src="https://picsum.photos/id/238/500/500" alt="Example picture" />
  </figure>
  <div class="card__content card__content--news">
    <h2 class="card__title card__title--news"><small class="card__topic">Local news</small>Really serious article title</h2>
    <p class="card__summary">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mollis congue massa vitae congue. Nullam eros ante, mollis eget varius ut, dignissim sed orci. Aliquam vitae feugiat nulla. Etiam tincidunt rhoncus quam eget pellentesque. Sed lobortis semper felis id venenatis.
    </p>

  </div>
</article>

<article class="card card--news">
  <figure class="card__figure card__figure--alt">
    <img class="card__image" src="https://picsum.photos/id/622/500/500" alt="Example picture" />
    <figcaption class="card__caption">Photo by: John Doe</figcaption>
  </figure>
  <div class="card__content card__content--news">
    <h2 class="card__title card__title--news"><small class="card__topic">Local news</small>Another serious article title</h2>
    <p class="card__summary">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mollis congue massa vitae congue. Nullam eros ante, mollis eget varius ut, dignissim sed orci. Aliquam vitae feugiat nulla. Etiam tincidunt rhoncus quam eget pellentesque. Sed lobortis semper felis id venenatis.
    </p>

  </div>
</article>

<section class="article-grid">

<article class="card card--gallery">
  <figure class="card__figure">
    <img class="card__image" src="https://picsum.photos/id/237/500/500" alt="Example picture" />
  </figure>
  <div class="card__content">
    <h2 class="card__title card__title--gallery"><small class="card__topic">Image gallery</small>Adorable doggos of the week</h2>
  </div>
</article>


<article class="card card--text">
  <div class="card__content card__content--text">
    <h2 class="card__title card__title--text"><small class="card__topic">Local news</small>Article title without image</h2>
    <p class="card__summary">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mollis congue massa vitae congue. Nullam eros ante, mollis eget varius ut, dignissim sed orci. Aliquam vitae feugiat nulla.
    </p>
    <p class="card__summary">
      Etiam tincidunt rhoncus quam eget pellentesque. Sed lobortis semper felis id venenatis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mollis congue massa vitae congue.
    </p>
  </div>
</article>
  
</section>
  
  <article class="card card--text">
  <div class="card__content card__content--text">
    <h2 class="card__title card__title--text"><small class="card__topic">Local news</small>Another article title without image</h2>
    <p class="card__summary">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mollis congue massa vitae congue. Nullam eros ante, mollis eget varius ut, dignissim sed orci. Aliquam vitae feugiat nulla.
    </p>
    <p class="card__summary">
      Etiam tincidunt rhoncus quam eget pellentesque. Sed lobortis semper felis id venenatis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mollis congue massa vitae congue.
    </p>
  </div>
</article>
              
            
!

CSS

              
                html {
  box-sizing: border-box;
}

* {
  box-sizing: inherit;
}

body {
  width: 768px;
  padding: 1.5em 1em 0;
  margin: 0 auto;
  line-height: 1.4;
  color: #0f0f0f;
  font-family: Helvetica, Arial, sans-serif;
}

img, figure {
  margin: 0;
  display: block;
  max-width: 100%;
  height: auto;
}

p {
  margin-top: 0;
}

p + p {
  margin-bottom: 0.5em;
}

.card {
  display: grid;
  background: #f5f5f5;
  margin-bottom: 1.5em;
}

.card--news {
  grid-template-columns: 290px auto;
}

.card--text {
  padding: 1.5em 2em 2em;
}

.card--featured {
  grid-template-columns: 60% auto;
}

.card__title {
  margin: 0;
  line-height: 1.3;
}

.card__title--news {
  padding-top: 1em;
  padding-bottom: 1em;
}

.card__title--text {
  padding-bottom: 0.6em;
}

.card__content--news {
  padding: 1em 1.5em;
}

.card__title--featured {
  padding-bottom: 0.5em;
}

.card__content--featured {
  padding: 1.5em;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
}

.card__topic {
  font-size: 0.5em;
  opacity: 0.8;
  margin-bottom: 1em;
  padding-bottom: 0.5em;
  padding-left: 0.5em;
  margin-left: -0.5em;
  margin-right: -0.5em;
  border-bottom: 1px solid currentColor;
  display: block;
}

.card__title--gallery {
  padding: 1.25em 1em 1.5em;
}

.card__summary {
  font-size: 0.95em;
  line-height: 1.7;
}

.card__wrapper {
  color: #f5f5f5;
  position: relative;
}

.article-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 1.5em;
}

.card__figure--alt {
  position: relative;
}

.card__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  color: #f5f5f5;
  background: rgba(0,0,0,0.6);
  font-size: 0.75em;
  padding: 1em 2em;
}
              
            
!

JS

              
                
              
            
!
999px

Console