Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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 class="text-center">Bootstrap 3</h1>
<h2 class="text-center">Resize the window to see the grid that's being used.</h2>
<hr>

<!-- EXTRA SMALL GRID -->
<div class="container text-center">
  <div class="row visible-xs">
    <h3>At this point, the window width is less than 768px <strong></strong>. You'll use Bootstrap's grid for <strong class="bg-color">extra small screens</strong>.</h3>
    <hr>
    <h4>You have to wrap your rows inside a <strong>container</strong> or a <strong>fluid container</strong>.</h4>
    <h4>For this viewport size, the width of the container expands to fill the window's width.</h4>
    <h4>If you select the fluid-container, its width will always have the width of the viewport size.</h4>
    <hr>
    <h4>Each row can have up to 12 columns.</h4>
    <h4>The class prefix you can use to set the size of your columns is <code>col-xs-#</code>.</h4>
    <p>For instance, if you want two equal-sized columns, you'll use the <code>col-xs-6</code> class.</p>
    <p>Keep in mind that in case you'll not specify a column size for extra small screens, they will be appearing stacked. That means, they will occupy the full width of their container (<code>col-xs-12</code>).</p>
    <hr>
    <p>Using <strong>offset</strong> classes (for example, <code>col-xs-offset-2</code>) you can center or move columns to the right. These classes change the <code>margin-left</code> value of each column.</p>
    <p>Using <strong>push & pull</strong> classes (for example, <code>col-xs-push-2</code>) you can move columns to the left and right respectively. These classes change the <code>left</code> and <code>right</code> values of each column.</p>
    <p>Using <strong>visibility</strong> classes (for example, <code>visible-xs</code>) you can adjust the content that will be appearing in this viewport size.</p>
    <hr>
    <p>Demo by George Martsoukos. <a href="http://www.sitepoint.com/grid-system-comparison-bootstrap-vs-foundation" target="_blank">See article</a>.</p>
  </div>
  
  <!-- SMALL GRID -->
  <div class="row text-center visible-sm">
    <h3>At this point, the window width is 768px and up <strong></strong>. You'll use Bootstrap's grid for <strong class="bg-color">small screens</strong>.</h3>
    <h4>You have to wrap your rows inside a <strong>container</strong> or a <strong>fluid container</strong>.</h4>
    <hr>
    <h4>For this viewport size, the width of the container is 750px.</h4>
    <h4>If you select the fluid-container, its width will always have the width of the viewport size.</h4>
    <hr>
    <h4>Each row can have up to 12 columns.</h4>
    <h4>The class prefix you can use to set the size of your columns is <code>col-sm-#</code>.</h4>
    <p>For instance, if you want two equal-sized columns, you'll use the <code>col-sm-6</code> class.</p>
    <p>Keep in mind that in case you'll not specify a column size for small screens, they will inherit the styles from the extra small screens.</p>
    <hr>
    <p>Using <strong>offset</strong> classes (for example, <code>col-sm-offset-2</code>) you can center or move columns to the right. These classes change the <code>margin-left</code> value of each column.</p>
    <p>Using <strong>push & pull</strong> classes (for example, <code>col-sm-push-2</code>) you can move columns to the left and right respectively. These classes change the <code>left</code> and <code>right</code> values of each column.</p>
    <p>Using <strong>visibility</strong> classes (for example, <code>visible-sm</code>) you can adjust the content that will be appearing in this viewport size.</p>
    <hr>
    <p>Demo by George Martsoukos. <a href="http://www.sitepoint.com/grid-system-comparison-bootstrap-vs-foundation" target="_blank">See article</a>.</p>
  </div>
  
  <!-- MEDIUM GRID -->
  <div class="row text-center visible-md">
    <h3>At this point, the window width is 992px and up <strong></strong>. You'll use Bootstrap's grid for <strong class="bg-color">medium screens</strong>.</h3>
    <h4>You have to wrap your rows inside a <strong>container</strong> or a <strong>fluid container</strong>.</h4>
    <hr>
    <h4>For this viewport size, the width of the container is 950px.</h4>
    <h4>If you select the fluid-container, its width will always have the width of the viewport size.</h4>
    <hr>
    <h4>Each row can have up to 12 columns.</h4>
    <h4>The class prefix you can use to set the size of your columns is <code>col-md-#</code>.</h4>
    <p>For instance, if you want two equal-sized columns, you'll use the <code>col-md-6</code> class.</p>
    <p>Keep in mind that in case you'll not specify a column size for medium screens, they will inherit the styles from the previous screens.</p>
    <hr>
    <p>Using <strong>offset</strong> classes (for example, <code>col-md-offset-2</code>) you can center or move columns to the right. These classes change the <code>margin-left</code> value of each column.</p>
    <p>Using <strong>push & pull</strong> classes (for example, <code>col-md-push-2</code>) you can move columns to the left and right respectively. These classes change the <code>left</code> and <code>right</code> values of each column.</p>
    <p>Using <strong>visibility</strong> classes (for example, <code>visible-md</code>) you can adjust the content that will be appearing in this viewport size.</p>
    <hr>
    <p>Demo by George Martsoukos. <a href="http://www.sitepoint.com/grid-system-comparison-bootstrap-vs-foundation" target="_blank">See article</a>.</p>
  </div>
  
  <!-- LARGE GRID -->
  <div class="row text-center visible-lg">
    <h3>At this point, the window width is 1200px and up <strong></strong>. You'll use Bootstrap's grid for <strong class="bg-color">large screens</strong>.</h3>
    <h4>You have to wrap your rows inside a <strong>container</strong> or a <strong>fluid container</strong>.</h4>
    <hr>
    <h4>For this viewport size, the width of the container is 1170px.</h4>
    <h4>If you select the fluid-container, its width will always have the width of the viewport size.</h4>
    <hr>
    <h4>Each row can have up to 12 columns.</h4>
    <h4>The class prefix you can use to set the size of your columns is <code>col-lg-#</code>.</h4>
    <p>For instance, if you want two equal-sized columns, you'll use the <code>col-lg-6</code> class.</p>
    <p>Keep in mind that in case you'll not specify a column size for large screens, they will inherit the styles from the previous screens.</p>
    <hr>
    <p>Using <strong>offset</strong> classes (for example, <code>col-lg-offset-2</code>) you can center or move columns to the right. These classes change the <code>margin-left</code> value of each column.</p>
    <p>Using <strong>push & pull</strong> classes (for example, <code>col-lg-push-2</code>) you can move columns to the left and right respectively. These classes change the <code>left</code> and <code>right</code> values of each column.</p>
    <p>Using <strong>visibility</strong> classes (for example, <code>visible-lg</code>) you can adjust the content that will be appearing in this viewport size.</p>
    <hr>
    <p>Demo by George Martsoukos. <a href="http://www.sitepoint.com/grid-system-comparison-bootstrap-vs-foundation" target="_blank">See article</a>.</p>
  </div>
</div>
              
            
!

CSS

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

body {
  font-size: 16px;
}

body, h1, h2, h3, h4 {
  font-family: 'Source Sans Pro', sans-serif;
}

h1, h2, h3, h4 {
  line-height: 1.4;
}

h1 {
  font-weight: 700;
}

p {
  line-height: 1.6;
}

a {
  color: white;
}

h3 {
  margin-bottom: 25px;
}

.bg-color {
  background: #bdbd00;
  padding: 3px;
}

h4, p {
  margin-bottom: 15px;
}

@media only screen and (max-width:767px) {
  body {
    background: lightblue;
  }
}

@media only screen and (min-width: 768px) {
  body {
    background: #4baac8;
  }
}

@media only screen and (min-width: 992px) {
  body { 
    background: LightSteelBlue;
  }
}

@media only screen and (min-width: 1200px) {
  body {
    background: #688ec0;
  } 
}
              
            
!

JS

              
                $(window).on('load resize', function(){
  var $browserWidth = $(window).width();
  $('h3 strong:first-child').text('(' + $browserWidth + 'px)').css('color', 'white');
});
              
            
!
999px

Console