123

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="container">
  <h1>
Ems and Rems
</h1>
<h2>
This h2 has no parent element and it's font-size is 2em.
</h2>

<div class="momanddad">
  <h2>
   This h2 has a font-size of 2em and it is inside of a parent container called .momanddad, which has a font-size of .6em. It's actual size is 1.2em, because the two em values multiply.
    
  
  </h2>
  
  <h3>
    This is an h3, which has a font-size of 2rem<span class="red">*</span> and is inside of the .momanddad element too, but it ignored the em-based font-size on the div.
</h3>
  
</div>

  <p><strong>Solution:</strong> How can you avoid all of these issues? Use rems or just don't put font-size on anything that isn't a text element.</p>

    <p><strong>*Note:</strong> Rems are *mostly* cross-browser friendly, but to make sure, include the pixel equilavent of font-size above the rem line one in case the browser can't read ems (see h3 css or read more <a href="http://caniuse.com/#search=rem" target="_blank">here</a>).</p>
</div>
            
          
!
            
              html {
  font-size: 100%;
   font-family: "brandon-grotesque",sans-serif;
  padding-bottom: 5em;
}

.container {
  width: 700px;
  margin: 0 auto;
}
h1 {
  text-align: center;
  font-size: 3em;
}

h2 {
  font-size: 2em;
}

.momanddad {
  font-size: .6em;
  outline: red 1px solid;
  padding: 1em 2%;
}

h3 {
  font-size: 48px; /* fall back in case browser can't read rems */
 font-size: 2rem;}

p strong, span.red,a:link, a:visited {
  color: red;
}

p {
    font-size: 1.4em;
}


            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console