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.

            
              /* ===========================================
   Defining media queries
   =========================================== */

@mixin bp-huge {
  @media only screen and (min-width: 65em) {
    @content;    
  }  
}

@mixin bp-medium {
  @media only screen and (min-width: 35em) {
    @content;    
  }  
}

@mixin bp-small {
  @media only screen and (min-width: 25em) {
    @content;    
  }  
}

/* ===========================================
   Mixin for writing out breakpoint names in
   an after pseudo element
   =========================================== */

@mixin define-breakpoint($name) {
	&:after {
		content: $name;
		display: none;
	}
}

/* ===========================================
   Calling our writing-out function
   =========================================== */

body {
    @include bp-small(){
        @include define-breakpoint("bp-small");
    }  

    @include bp-medium(){
        @include define-breakpoint("bp-medium");
    }
  
    @include bp-huge(){
        @include define-breakpoint("bp-large");
    }
}


/* ===========================================
   Demo styling only
   =========================================== */

html {
  height: 100%;
  transform-style: preserve-3d;
}

body {
  margin: 0;
  text-align: center;
  font-size: 4vw;
  font-family: sans-serif;
  background: #E33D61;
  color: #FFFFFF;
  text-transform: uppercase;
  position: relative;
  top: 50%;  
  transform: translateY(-50%);
  font-weight: normal;
}

span {
  display: block;
  color: #812236;
  font-weight: bold;
  font-size: 5.5vw;
}
            
          
!
            
              'use strict';
var Z63 = (function (parent, $) {

    var MediaQueryListener = function() {
        this.afterElement = window.getComputedStyle ? window.getComputedStyle(document.body, ':after') : false;
        this.currentBreakpoint = '';
        this.lastBreakpoint = '';
        this.init();
    };

    MediaQueryListener.prototype = {

        init: function () {
            var self = this;
            
            if(!self.afterElement) {
                return;
            }

            self._resizeListener();

        },
        _resizeListener: function () {
            var self = this;

            $(window).on('resize orientationchange load', function() {
                self.currentBreakpoint = self.afterElement.getPropertyValue('content');
                
                if (self.currentBreakpoint !== self.lastBreakpoint) {
                    $(window).trigger('breakpoint-change', self.currentBreakpoint);
                    self.lastBreakpoint = self.currentBreakpoint;
                }
                
            });
        }

    };

    parent.mediaqueryListener = parent.mediaqueryListener || new MediaQueryListener();

    return parent;

}(Z63 || {}, jQuery));

$(window).on('breakpoint-change', function(e, breakpoint) {

    if(breakpoint === 'bp-small') {
        document.body.innerHTML = 'CSS Breakpoint <span>screen-small</span>';
    }

    if(breakpoint === 'bp-medium') {
        document.body.innerHTML = 'CSS Breakpoint <span>screen-medium</span>';
    }

    if(breakpoint === 'bp-large') {
        document.body.innerHTML = 'CSS Breakpoint <span>screen-large</span>';
    }

});
            
          
!
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