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

              
                <h2>A font-weight Sass mixin for designers</h2>
<dl>
  <dt>font-weight in css</dt>
  <dd>string representation</dd>
  <dt>100</dt>
  <dd class="w100">thin</dd>
  <dt>200</dt>
  <dd class="w200">extra-light, ultra-light</dd>
  <dt>300</dt>
  <dd class="w300">light</dd>
  <dt>400</dt>
  <dd class="w400">normal, book, regular</dd>
  <dt>500</dt>
  <dd class="w500">medium</dd>
  <dt>600</dt>
  <dd class="w600">semi-bold, demi-bold</dd>
  <dt>700</dt>
  <dd class="w700">bold</dd>
  <dt>800</dt>
  <dd class="w800">extra-bold</dd>
  <dt>900</dt>
  <dd class="w900">ultra-bold, heavy, black, ultra, ultra-black, extra-ultra</dd>
</dl>
<p>
  This mixin will take all the values your native font-weight CSS property takes, like <em>lighter</em> and <em>bolder</em> as well as <em>numeric values</em>. Added are the values listed above. Because these are the names traditional designers tend to know font weights by :).
</p>
              
            
!

CSS

              
                @import "compass/css3";

// A quick and simple font-weight mixin

// Inspired by a tweet by Sidoruk Sergey (@Sidoruk_SV)
// https://twitter.com/Sidoruk_SV/status/422746337394716672

@mixin font-weight($weight) {
  $weights: (
    thin: 100,
    extra-light: 200,
    ultra-light: 200,
    light: 300,
    normal: 400,
    book: 400,
    regular: 400,
    medium: 500,
    semi-bold: 600,
    demi-bold: 600,
    bold: 700,
    extra-bold: 800,
    ultra-bold: 900,
    heavy: 900,
    black: 900,
    ultra: 900,
    ultra-black: 900,
    extra-ultra: 900
  );
  
  $output: $weight;
  @if map-has-key($weights, $weight) {
    $output: map-get($weights, $weight);
  }
  
  font-weight: $output;
}

dd.w100 {
  @include font-weight(thin);
}
dd.w200 {
  @include font-weight(extra-light);
}
dd.w300 {
  @include font-weight(light);
}
dd.w400 {
  @include font-weight(book);
}
dd.w500 {
  @include font-weight(medium);
}
dd.w600 {
  @include font-weight(semi-bold);
}
dd.w700 {
  @include font-weight(bold);
}
dd.w800 {
  @include font-weight(extra-bold);
}
dd.w900 {
  @include font-weight(ultra-bold);
}


// Some styling
@import url(https://fonts.googleapis.com/css?family=Raleway:100,200,300,400,500,600,700,800,900);
@import url(https://fonts.googleapis.com/css?family=Lora:400,400italic,700,700italic&subset=latin,cyrillic);

body { 
  height: 100%; 
  width: 100%;
  font-family: 'Raleway', sans-serif;
  font-size: 18px;
  @include background(radial-gradient(white 20%, #e0e0e0 100%));
  text-align: center;
  text-rendering: optimizeLegibility;
}

h2 {
  font-family: 'Lora', serif;
  font-style: italic;
  margin: 3em auto .8em;
  max-width: 520px;
}

dl, dt, dd {
  padding: 0; margin: 0;
}

p, dl {
  width: 70%;
  min-width: 660px;
}

dl {
  overflow: hidden;
  margin: 1em auto;
  
  dt, dd {
    float: left; 
    width: 50%;
    border-bottom: 1px solid #ccc;
    text-align: center;
    //padding: .5em;
    //@include box-sizing(border-box);
    min-height: 35px;
    line-height: 35px;
  }
  
  dt { width: 25%; clear: left; @include font-weight(book) }
  dd { width: 75%; clear: right; }
  
  dd + dd {
    padding-left: 25%;
    //border: 0;
  }
  
  dt:first-of-type, dd:first-of-type {
    @include font-weight(medium);
    font-size: .65em;
    //text-transform: uppercase;
  }
}

p {
  margin: 0 auto;
  text-align: left;
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  
  em {
    @include font-weight(bolder);
  }
} 
              
            
!

JS

              
                
              
            
!
999px

Console