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

              
                <article class="card">
  <h1 class="card__heading">CSS for developers</h1>
  <div class="card__body">Computers have become ubiquitous in almost every facet of our lives. At work, desk jockeys spend hours in front of their desktops, while delivery people scan bar codes with handhelds and workers in the field stay in touch with the central office via their notebooks. At home, we rely on our….</div>
  <a href="#" class="card__action">Action link</a>
</article>
              
            
!

CSS

              
                // Light mode
// ------------------------------------------------------------
:root {
  
  // HSL
  --hue: 205;
  --saturation: 100%;
  --lightness: 50%;
  
  // Color palette
  --primary-color: hsl(var(--hue), var(--saturation), var(--lightness));
  --secondary-color: hsl(calc(var(--hue) + 180), var(--saturation), var( --lightness));
  
  // Scaffolding
  --body-bg: hsl(var(--hue), calc(var(--saturation) * 0), calc(var(--lightness) * 5));
  --border-width: 1px;
  --font-family: "Source Sans Pro";
  --font-family-alt: "Quattrocento";
  --line-height-base: 1.45;
  
  // Card
  --card-width: 532px;
  --card-padding: 24px 34px 42px; 
  --card-bg: var(--body-bg);
  --card-border-color: hsla(var(--hue), calc(var(--saturation) * 0), calc(var(--lightness) * 1.8), 1);
  --card-font-family: var(--font-family);
  --card-font-size: 1rem;
  --card-text-color: hsl(var(--hue), calc(var(--saturation) * 0), calc(var(--lightness) * 0.7));
  --card-link-padding: 6px 18px;
  --card-link-bg: var(--secondary-color);
  --card-link-color: hsl(calc(var(--hue) + 180), var(--saturation), calc(var( --lightness) * 3));
  --card-link-family: var(--font-family);
  --card-link-size: 1.25rem;
  --card-link-decoration: none;
  --card-shadow: hsla(0, 0%, 0%, 0.1);
}


// Dark mode
// ------------------------------------------------------------
@media (prefers-color-scheme: dark) {
  :root {
    
    // HSL
    --hue: 120;
    --lightness: 70%;
    
    // Scaffolding
    --body-bg: hsl(var(--hue), calc(var(--saturation) * 0), calc(var(--lightness) * 0.25));
    --border-width: 3px;
    --line-height-base: 1.55;
    
    // Card
    --card-width: 640px;
    --card-padding: 34px 42px; 
    --card-bg: hsl(var(--hue), calc(var(--saturation) * 0), calc(var(--lightness) * 0.325));
    --card-border-color: hsla(var(--hue), calc(var(--saturation) * 0), calc(var(--lightness) * 1.8), 0.05);
    --card-font-family: var(--font-family-alt);
    --card-font-size: 1.2rem;
    --card-text-color: hsl(var(--hue), calc(var(--saturation) * 0), var(--lightness));
    --card-link-padding: 0;
    --card-link-bg: null;
    --card-link-color: hsl(calc(var(--hue) + 180), var(--saturation), calc(var( --lightness) * 1.1));
    --card-link-size: 1.55rem;
    --card-link-decoration: underline;
    --card-shadow: hsla(0, 0%, 0%, 0.7);
  }
}


// Global styles
// ------------------------------------------------------------
* { box-sizing: border-box }

body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background-color: var(--body-bg);
  line-height: var(--line-height-base);
}


// Card
// ------------------------------------------------------------
.card {
  width: var(--card-width);
  border: var(--border-width) solid var(--card-border-color);
  border-radius: 6px;
  padding: var(--card-padding);
  background-color: var(--card-bg);
  color: var(--card-text-color);
  font-family: var(--card-font-family);
  font-size: var(--card-font-size);
  box-shadow: 0 2px 15px var(--card-shadow);
}

.card__heading {
  margin-bottom: 1rem;
  color: var(--primary-color);
  font-family: "Alfa Slab One";
  font-size: 2.6rem;
  font-weight: 400;
}

.card__body {
  margin-bottom: 32px;
}

.card__action {
  border: 0;
  border-radius: 5px;
  padding: var(--card-link-padding);
  background-color: var(--card-link-bg);
  color: var(--card-link-color);
  font-family: var(--card-link-family);
  font-size: var(--card-link-size);
  font-weight: bold;
  text-decoration: var(--card-link-decoration);
}
              
            
!

JS

              
                
              
            
!
999px

Console