cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

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.

            
              <html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content=="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Responsive Bootstrap Toolkit</title>
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
    <!-- Include default Bootstrap stylesheet -->
    <link rel="stylesheet" type="text/css" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"/>
</head>

<body>

    <div class="wrapper">
        <div class="site-topbar clearfix" data-compact-height="40" data-fullsize-height="60">
            <h5 class="text-uppercase">Responsive Bootstrap Toolkit</h5>
            <div class="breakpoint-alias pull-right text-center"></div>
        </div>

        <div class="container-fluid">
            <div class="row">
                <div class="col-xs-12 col-sm-8 col-md-6 col-lg-6 col-sm-push-2 col-md-push-3 col-lg-push-3">
                    <br/>
                    <br/>
                    <p>Boxes below get highlighted whenever current viewport matches their expression. Alias of current breakpoint is visible in the top right corner.</p>
                    <br/>
                    
                    <div class="comparison-boxes">
                        <div class="comparison-operator box-1">
                            &lt;=sm
                        </div>
                        <div class="comparison-operator box-2">
                            md
                        </div>
                        <div class="comparison-operator box-3">
                            &gt;md
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="https://rawgit.com/maciej-gurban/responsive-bootstrap-toolkit/master/dist/bootstrap-toolkit.min.js"></script>

</body>
</html>

            
          
!
            
              /*
 * None of the CSS in this example is necessary for the base script to work properly. The only required CSS is the one shipped with Bootstrap.
 */

/* This example's styling */

@media (max-width: 767px) {
  .breakpoint-alias:before {
    content: "XS";
  }
}
@media (min-width: 768px) and (max-width: 983px) {
  .breakpoint-alias:before {
    content: "SM";
  }
}
@media (min-width: 984px) and (max-width: 1199px) {
  .breakpoint-alias:before {
    content: "MD";
  }
}
@media (min-width: 1200px) {
  .breakpoint-alias:before {
    content: "LG";
  }
}

body {
  font-family: 'Open Sans', sans-serif;
}

@media (max-width: 767px) {
  h1 {
    font-size: 20px;
  }
}
@media (min-width: 768px) and (max-width: 983px) {
  h1 {
    font-size: 24px;
  }
}
@media (min-width: 984px) and (max-width: 1199px) {
  h1 {
    font-size: 24px;
  }
}
@media (min-width: 1200px) {
  h1 {
    font-size: 30px;
  }
}

.wrapper {
  background: white;
  color: #666666;
}
.wrapper .site-topbar {
  height: 60px;
  line-height: 60px;
  vertical-align: middle;
  background: #414141;
  color: white;
  position: relative;
  vertical-align: middle;
}
.wrapper .site-topbar h5 {
  height: inherit;
  line-height: inherit;
  vertical-align: middle;
  font-weight: 300;
  margin: 0 60px 0 15px;
  vertical-align: middle;
}
.wrapper .site-topbar .breakpoint-alias {
  background-color: #238cce;
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 60px;
  margin: auto;
}

.comparison-boxes {
  text-align: justify;
  font-size: 0.1px;
}
.comparison-boxes:after {
  content: '';
  display: inline-block;
  width: 100%;
}

.comparison-operator {
  height: 140px;
  line-height: 140px;
  vertical-align: middle;
  display: inline-block;
  background: #414141;
  color: white;
  font-size: 25px;
  text-align: center;
  width: 33%;
  min-height: 50%;
}
.comparison-operator.active {
  background: #238cce;
}

.text-uppercase {
  text-transform: uppercase;
}

            
          
!
            
              (function($, document, window, viewport){

    var highlightBox = function( className ) {
        $(className).addClass('active');
    }

    var highlightBoxes = function() {
        $('.comparison-operator').removeClass('active');

        if( viewport.is("<=sm") ) {
            highlightBox('.box-1');
        }

        if( viewport.is("md") ) {
            highlightBox('.box-2');
        }

        if( viewport.is(">md") ) {
            highlightBox('.box-3');
        }
    }

    // Executes once whole document has been loaded
    $(document).ready(function() {

        highlightBoxes();

        console.log('Current breakpoint:', viewport.current());

    });

    $(window).resize(
        viewport.changed(function(){
            highlightBoxes();

            console.log('Current breakpoint:', viewport.current());
        })
    );

})(jQuery, document, window, ResponsiveBootstrapToolkit);
            
          
!
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