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

              
                <div class="demo media-grid">
  <div class="media-oject">
    object
  </div>
  <div class="media-body">
    body<br />
    body<br />
    body<br />
    body
  </div>
</div>

<div class="demo notification-flex">
  <div class="notification-flex-icon">
    icon
  </div>
  <div class="notification-flex-message">
    message
  </div>
  <div class="notification-flex-cta">
    CTA
  </div>
</div>

<div class="layout-flex demo">
  <div class="layout-flex__item">item</div>
  <div class="layout-flex__item">item</div>
  <div class="layout-flex__item">item</div>
  <div class="layout-flex__item">item</div>
</div>

<div class="row-grid demo">
  <div class="row-grid__left">left</div>
  <div class="row-grid__right">right</div>
</div>

<div class="notification-layout-grid demo">
  <div class="notification-layout-grid__icon">icon</div>
  <div class="notification-layout-grid__message">message</div>
  <div class="notification-layout-grid__cta">CTA</div>
</div>

<div class="notification-layout-flex demo">
  <div class="notification-layout-flex__icon">icon</div>
  <div class="notification-layout-flex__message">message</div>
  <div class="notification-layout-flex__cta">CTA</div>
</div>

<div class="notification-layout-grid-auto demo">
  <div class="notification-layout-grid-auto__icon">icon</div>
  <div class="notification-layout-grid-auto__message">message</div>
  <div class="notification-layout-grid-auto__cta">CTA</div>
</div>

<div class="preview-layout demo">
  <div class="preview-layout__title">title</div>
  <div class="preview-layout__description">description</div>
  <div class="preview-layout__tags">tags</div>
  <div class="preview-layout__cta">CTA</div>
</div>

              
            
!

CSS

              
                /* Demo styles */

div {
  font: normal 1rem/1.5 georgia, serif;
  color: #808080;
  outline: 2px solid #40BF4F;
}

.demo {
  margin-bottom: 20px;
}

/* Media with grid */

.media-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-column-gap: 1rem;
  align-items: start;
}

/* Notification with flexbox */

.notification-flex {
  display: flex;
  /*margin: -0.5rem;*/ /* turned off for demo purposes */
}

.notification-flex-icon,
.notification-flex-message,
.notification-flex-cta {
  padding: 0.5rem;
}

.notificaton-flex-icon {
  flex: none;
}

.notification-flex-message {
  flex: 1;
}

/* Flex layout with new gap property (only works in FF) */

.layout-flex {
  display: flex;
  flex-flow: row wrap;
  gap: 1rem;
}

.layout-flex__item {
  flex: 1 0 auto;
}

/* Row with grid */

.row-grid {
  display: grid;
  grid-template-columns: auto auto;
  grid-column-gap: 1rem;
  justify-content: space-between;
  align-items: baseline;
}

/* Notification layout with grid */

.notification-layout-grid {
    display: grid;
    grid-template-columns: 2rem 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
        "icon message"
        "cta cta";
    grid-gap: 1rem;
    align-items: center;
}

@media (min-width: 60em) {
  .notification-layout-grid {
    grid-template-columns: 2rem 1fr 50%;
    grid-template-rows: auto;
    grid-template-areas: "icon message cta"; 
  }
}

.notification-layout-grid__icon {
    grid-area: icon;
}

.notification-layout-grid__message {
    grid-area: message;
}

.notification-layout-grid__cta {
    grid-area: cta;
}

/* Notification layout with flexbox */

.notification-layout-flex {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
}

.notification-layout-flex__icon {
  width: 2rem;
  margin-right: 1rem;
}

.notification-layout-flex__message {
  flex: 1;
}

.notification-layout-flex__cta {
  flex: 1 0 100%;
  margin-top: 1rem;
}

@media (min-width: 60em) {
  .notification-layout-flex {
    flex-wrap: nowrap;
  }
  
  .notification-layout-flex__cta {
    flex: 0 1 50%;
    margin-top: 0;
    margin-left: 1rem;
  }
}

/* Notification layout with grid and autoplacement */

.notification-layout-grid-auto {
    display: grid;
    grid-template-columns: 2rem 1fr;
    grid-template-rows: auto auto;
    grid-gap: 1rem;
    align-items: center;
}

.notification-layout-grid-auto__cta {
    grid-column: span 2;
}

@media (min-width: 60em) {
  .notification-layout-grid-auto {
    grid-template-columns: 2rem 1fr 50%;
    grid-template-rows: auto;
  }
  
  .notification-layout-grid-auto__cta {
    grid-column: span 1;
  }
}

/* Preview layout with grid */

.preview-layout__title,
.preview-layout__description,
.preview-layout__tags {
    margin-bottom: 1rem;
}

@media (min-width: 60em) {
    .preview-layout {
        display: grid;
        grid-template-columns: auto auto 1fr;
        grid-template-rows: auto auto;
        grid-template-areas:
            "title tags cta"
            "description description cta";
        grid-column-gap: 1rem;
    }
    
    .preview-layout__title,
    .preview-layout__description,
    .preview-layout__tags {
        margin-bottom: 0;
    }

    .preview-layout__title {
        grid-area: title;
        align-self: baseline;
    }

    .preview-layout__description {
        grid-area: description;
    }

    .preview-layout__tags {
        grid-area: tags;
        align-self: baseline;
    }

    .preview-layout__cta {
        grid-area: cta;
        justify-self: end;
        align-self: center;
    }
}

              
            
!

JS

              
                // Nothing here.

              
            
!
999px

Console