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

              
                <p>The breakpoint (as known to the JS) is <span class="breakpoint">Breakpoint</span>.</p>
<p>This works on IE9+ and all other browsers that support media queries.</p>
<p>The article describing this technique can be found on <a href="https://www.lullabot.com/blog/article/simpler-solution-bring-css-breakpoints-javascript" target="_blank">Lullabot.com</a>.</p>
              
            
!

CSS

              
                /**
 * These values will not show up in content, but can be 
 * queried by JavaScript to know which breakpoint is active.
 * Add or remove as many breakpoints as you like.
 */
body:before {
  content: "smartphone";
  display: none; /* Prevent from displaying. */
}
@media (min-width: 550px) {
  body:before {
    content: "smartphone_wide";
  }
}
@media (min-width: 650px) {
  body:before {
    content: "tablet_narrow";
  }
}
@media (min-width: 900px) {
  body:before {
    content: "tablet_wide";
  }
}
@media (min-width: 1100px) {
  body:before {
    content: "desktop";
  }
}
@media (min-width: 1500px) {
  body:before {
    content: "wide";
  }
}
@media (min-width: 2000px) {
  body:before {
    content: "OMG_THATS_SO_HUGE";
  }
}

/* A bit of fluff */
::selection {
  background: #ca322c;
  color: white;
}
body {
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 1.16em;
  color: #4b4b4b;
  margin-top: 50px;
}
p {
  width: 80%;
  max-width: 600px;
  padding-left: 10%;
}
a {
  color: #ca322c;
}
.breakpoint {
  background-color: #ca322c;
  color: white;
  display: inline-block;
  padding: 2px 4px;
}
              
            
!

JS

              
                var breakpoint = {};
breakpoint.refreshValue = function () {
    this.value = window.getComputedStyle(
      document.querySelector('body'), ':before'
    ).getPropertyValue('content').replace(/\"/g, '');
  };
$(window).resize(function () {
  breakpoint.refreshValue();
  $('.breakpoint').html(breakpoint.value);
}).resize();
// Tada!
              
            
!
999px

Console