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

              
                <div class="alert alert-error">
  <div class="alert-content">
    <h2 class="alert-title">
      It look like there was a problem.
    </h2>
    <div class="alert-body">
      <p>Please make sure to double check that the form below has all the correct information.</p>
    </div>
  </div>
</div>

<div class="alert alert-warning">
  <div class="alert-content">
    <h2 class="alert-title">
      We need more information before we begin.
    </h2>
    <div class="alert-body">
      <p>If you don’t submit this information by January 24 2019 there could be penalties and surcharges added.</p>
    </div>
  </div>
</div>

<div class="alert alert-success">
  <div class="alert-content">
    <h2 class="alert-title">
      Success!
    </h2>
    <div class="alert-body">
      <p>We’ve sent all your information to the agency and we’ll be in touch soon – there’s no need to worry.</p>
    </div>
  </div>
</div>
              
            
!

CSS

              
                $alertStyles: (
  error: (
    theme: #fff5f5,
    icon: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/14179/error.svg',
    darkTheme: #f78b8b
  ),
  success: (
    theme: #f0f9ef,
    icon: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/14179/success.svg',
    darkTheme: #7ebb7a
  ),
  warning: (
    theme: #fff9f0,
    icon: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/14179/warning.svg',
    darkTheme: #ffc848
  )
);

body {
  max-width: 600px;
  align-items: center;
  margin: 40px auto;
}

.alert {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  max-width: 600px;
  border-radius: 4px;
  background: #ccc;
  border: 1px solid #777;
  display: flex;
  margin-bottom: 20px;
  
  &:before {
    content: '';
    width: 80px;
    position: relative;
    z-index: 999;
    background-color: #777;
    background-repeat: no-repeat;
    background-position: center 16px;
    background-size: 30px;
  }
}

.alert-content {
  padding: 20px;
}

.alert-title {
  margin: 0;
  margin-bottom: 5px;
  font-size: 18px;
  padding: 0;
}

.alert-body {
  p {
    margin: 0;
    font-size: 16px;
  }
}



// Loop for styling

@each $state, $property in $alertStyles {
  $theme: map-get($property, theme);
  $darkTheme: map-get($property, darkTheme);
  $icon: map-get($property, icon);
  
  .alert-#{$state} {
    background-color: $theme;
    border-color: $darkTheme;  
    &:before {
      background-color: $darkTheme;
      background-image: url($icon);
    }
    .alert-title {
      color: $darkTheme;
    }
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console