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

              
                <h1>Breakpoint Sass</h1>
<h2>Even better nested media queries. Please resize me.</h2>

<div class="foo"></div>
<div class="baz"></div>
<div class="bar"></div>


              
            
!

CSS

              
                @import "breakpoint";

// Convert Pixel vales to ems
$breakpoint-to-ems: true;

// min-width is default when only a number is declared
$small: 480px;

// if two numbers are listed, then it assumes the first number is min-width and second is max-width
$medium: 600px 900px;

$large: 901px;

// string tests together within parentheses, assume each item is a feature value pair
$tall-height: (min-height 1000px) (orientation portrait);


// Include styles
.foo {
  background: #00C176;
  content: 'No Media Queries';
	
	@include breakpoint($small) {
    background: #49007E;
    content: 'Basic Media Query - Small';
  }

  @include breakpoint($medium) {
    background: #FF005B;
    content: 'Basic Media Query - Medium';
  }

	@include breakpoint($large) {
    background: #FF7D10;
    content: 'Basic Media Query - Large';
  }
}

$custom-pair: (height 100px 500px);
$pair-portrait: screen 321px 768px, handheld (orientation portrait);

.baz {
  background: #9A8194;
  content: 'No Media Queries';

  @include breakpoint($custom-pair) {
    background: #398A87;
    content: 'Custom Pair Media Query - Targeting Height';
  }

  @include breakpoint($pair-portrait) {
    content: 'Screen media type between 300px and 500px OR Handheld media type in Portrait';
  }
}

.foo:before {
  content: 'No Media Query';
  
	@include breakpoint($small) {
    content: 'Basic Media Query - Small';
  }

  @include breakpoint($medium) {
    content: 'Basic Media Query - Medium';
  }

  @include breakpoint($large) {
    content: 'Basic Media Query - Large';
  }
}

.baz:before {
  content: 'No Media Query';

  @include breakpoint($custom-pair) {
    content: 'Custom Pair Media Query - Targeting Height';
  }

  @include breakpoint($pair-portrait) {
    content: 'Screen media type between 300px and 500px OR Handheld media type in Portrait';
  }
}

$basic: screen 800px 1200px, min-height 300px, orientation landscape;

.bar {
  background: #4E395D;
  content: 'No Media Queries';

  @include breakpoint($basic) {
    content: 'min-height:' breakpoint-get-context('min-height');
    content: 'orientation:' breakpoint-get-context('orientation');
    content: 'max-width: ' breakpoint-get-context('max-width');
  }
}

.bar:before {
  content: 'No Media Query';

  @include breakpoint($basic) {
    content: "I am basic. Check the compiled CSS for context.";
  }
}

/* Non-layout Styles */

.baz,
.foo,
.bar {
	&:before {
		color: #fff;
		display: block;
		font-size: 1.75rem;
		padding: .7em 0;
		text-align: center;
		width: 100%;
	}
}

@import url(https://fonts.googleapis.com/css?family=Josefin+Sans:100,400,700);

// Base text styles to be used for elements in this pen
%type-base {
  color: #fff;
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 100;
}

$color-coral: #F45D4C;
$color-green: #A1DBB2;
$color-yellow: #FACA66;

body {
  @extend %type-base;
  background: #2d2d2d;
  margin: 0 auto;
	text-align: center;
}

h1 {
	font-size: 3.6rem;
	font-weight: 700;
	margin: 2rem auto .5rem;
}

h2 {
	color: lighten($color-coral, 15%);
	font-size: 1.6rem;
	font-weight: 100;
	margin: 0 auto 1.5rem;
}

              
            
!

JS

              
                
              
            
!
999px

Console