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

              
                <section>
    <h1>Sass Breakpoint Mixin Demo</h1>
    <p class="breaking-mobile">Mobile First</p>
    <p class="breaking-medium">Medium Value</p>
    <p class="breaking-large">Large Value</p>

    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt cum accusamus ullam facilis corporis natus omnis vero illo voluptas error impedit quo perferendis rerum. Voluptatibus molestias deserunt quod modi delectus sit incidunt qui facere quaerat quae molestiae veniam non numquam!</p>

    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam nam voluptatibus aperiam dolore odio modi expedita dolor recusandae quas id.</p>
</section>
              
            
!

CSS

              
                @import "compass/css3";

// Sass Breakpoint Mixin
@mixin breakpoint($point) {
    @if $point == medium {
        @media (min-width: 30em)  { @content; }
    }
    @else if $point == large {
        @media (min-width: 50em) { @content; }
    }
    @else if $point { // allows custom breakpoints
        @media (min-width: $point) { @content; }
    }
}


// demo styling & examples
body {
    background: #517293;
    font-size: 100%;
    line-height: 1.6;
    color: #f1f1f1;

    @include breakpoint(medium) {
        background: darken(#517293, 7.5%);
        font-size: 120%;
    }
    @include breakpoint(large) {
        background: darken(#517293, 15%);
        font-size: 140%;  
    }
}

section {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1em;
    h1 {
        text-shadow: 1px 1px #000;
    
        @include breakpoint(medium) {
            text-shadow: 3px 3px 2px #000;
        }
    }
}

.breaking-mobile {
 
    @include breakpoint(medium) {
        display: none;
    }
}

.breaking-medium {
    display: none;
  
    @include breakpoint(medium) {
        display: block;
    }
    @include breakpoint(large) {
        display: none;
    }
}

.breaking-large {
    display: none;
  
    @include breakpoint(large) {
        display: block;
    }
}
              
            
!

JS

              
                // Sass Breakpoint Mixin

// for mobile first media queries
// allows for custom breakpoints (which is very powerful), can be adaptated to pixel values if that is your thing

// more info scottnix.com/placement-of-media-queries/ which also includes a SublimeText snippet.

// adaptation of css-tricks.com/media-queries-sass-3-2-and-codekit/

              
            
!
999px

Console