Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <h1>RWD Calc SCSS Mixin</h1>

<p>A SCSS mixin for <a href="http://www.rwdcalc.com/">my little RWD calculator</a>. This is currently %/px only and only to be used with box-sizing: border-box (which means it won't work right in browsers that don't recognise it.</p>

<h2>To Do</h2>
<ul>
  <li>Make and non box-sizing: border-box version</li>
  <li>Make the @mixin bigger to include top/bottom/left/right margins, padding and borders</li>
  <li>Make it into a function</li>
  <li>Anything else??</li>
</ul>
              
            
!

CSS

              
                @import "compass/css3";

// Set-up page

html { 
  background-color: #383131;
  color: #F2F2F2;
  font-family: Georgia, Times, "Times New Roman", serif;
}


h1, h2, h3, h4, h5, h6{ 
  font-family: "Lucida Bright", Georgia, serif;
  color: #d15300; 
}
blockquote, iframe, label, p, pre, address, td, th, ul, ol, dl, dd, hr,
table {
   font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
  }

a {
  color: #d15300; 
  text-decoration: none;
}


// The RWD Calc SCSS mixin

* { 
     -moz-box-sizing: border-box; 
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}

@mixin rwdcalc($target, $context, $margin, $padding, $border) {
 
  width: percentage($target / $context);
  margin-left: percentage($margin / $target);
  margin-right: percentage($margin / $target);
  padding-left: percentage($padding / $target);
  padding-right: percentage($padding / $target);
  border: $border + px;
}

html {  }

body {
  
  @include rwdcalc(300, 320, 5, 3, 2);
    @media only screen and (min-width: 37.5em) {
      @include rwdcalc(500, 600, 50, 0, 0); 
    }
    @media only screen and (min-width: 68.5em) {
      @include rwdcalc(1000, 1100, 50, 0, 0); 
    }  
}

              
            
!

JS

              
                
              
            
!
999px

Console