cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div class="holder">
  <div class="parent">
    <div class="s600px">I am blue and under 600px wide.</div>
    <div class="s601px">I am red and over 600px wide.</div>
  </div>
</div>
            
          
!
            
              @import "compass/css3";

*, 
*:before, 
*:after {
  -moz-box-sizing: border-box; 
  -webkit-box-sizing: border-box; 
  box-sizing: border-box;
}
body, 
html { 
  margin:0; 
  padding:0;
  font-family: helvetica, sans-serif;
}
// *** Test begins here - change the html or change the body - MQs remain 16px based ***
html { 
  font-size: 100%; // This is what we want to change - 100% is 16px by default
}
body { 
  font-size: 1rem; // This is whatever base we've set the html element to be
}
.holder { height:100%; }
.parent { 
  height:50%; 
  min-height: 550px; 
  position:relative; 
  background: blue; 
  padding: 100px;
}
.s600px,
.s601px {
  padding: 25px;
  background: black;
  color: white; 
  text-align: center;
}
// At 16px, 37.5em should be 600px
// If HTML is set at 200%, and body is 1rem, how is the MQ holding on to a 16px multiplier?
@media only screen and (max-width: 37.5em) {
  .s600px { 
    display: block;
  }
  .s601px {
    display: none;
  }
}
@media only screen and (min-width: 37.5em) {
  .s601px { 
    display: block;
  }
  .s600px {
    display: none;
  }
  .parent {
    background: red;
  }
}
// And the answer is - USER SETTINGS!! Authors have no control.
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console