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

Auto Save

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

              
                <div class="container">
      <h2>Common Bootstrap 4 Grid Layouts</h2>
      <hr />

      

   <h2>One column centered</h2>


   <div class="row justify-content-center">
      <div class="col-md-6"></div>
   </div>

   <h2>Two column</h2>
   <div class="row">

      <div class="col-sm-6">

      </div>
      <!-- /.col -->
      <div class="col-sm-6">

      </div>
      <!-- /.col -->
   </div>
   <!-- /.row -->


   <h2>Two column - Golden Ratio Left</h2>
   <div class="row">

      <div class="col-sm-8">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-4">

      </div>
      <!-- /.col-sm-6 -->
   </div>
   <!-- /.row -->


   <h2>Two column - Golden Ratio Right</h2>
   <div class="row">

      <div class="col-sm-4">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-8">

      </div>
      <!-- /.col-sm-6 -->
   </div>
   <!-- /.row -->


   <h2>Three column</h2>
   <div class="row">

      <div class="col-sm-4">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-4">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-4">

      </div>
      <!-- /.col-sm-6 -->
   </div>
   <!-- /.row -->


   <h2>Four column</h2>
   <div class="row">

      <div class="col-sm-3">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-3">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-3">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-3">

      </div>
      <!-- /.col-sm-6 -->

   </div>
   <!-- /.row -->

   <h2>Five column</h2>
   <p>Does require some custom CSS</p>
   <div class="row row-5">
      <div class="col">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col">

      </div>
      <!-- /.col -->
      <div class="col">

      </div>
      <!-- /.col -->
      <div class="col">

      </div>
      <!-- /.col -->
      <div class="col">

      </div>
      <!-- /.col -->
   </div>
   <!-- /.row -->
   
   
   
   <h2>Six column</h2>
   <div class="row">

      <div class="col-sm-2">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-2">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-2">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-2">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-2">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-2">

      </div>
      <!-- /.col-sm-6 -->
   </div>
   <!-- /.row -->

   
   
 <h2>12 column</h2>
   <div class="row">
     <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-1">

      </div>
      <!-- /.col-sm-6 -->
   </div>
   <!-- /.row -->
   
   
   
 <h2>No Gutters - Two column</h2>
   <div class="row no-gutters">

      <div class="col-sm-6">

      </div>
      <!-- /.col -->
      <div class="col-sm-6">

      </div>
      <!-- /.col -->
   </div>
   <!-- /.row -->
   

   

</div>
<!-- /.container -->


<div class="container-fluid">
   <h2>Two column Fluid</h2>
   <div class="row">

      <div class="col-sm-6">

      </div>
      <!-- /.col-sm-6 -->
      <div class="col-sm-6">

      </div>
      <!-- /.col-sm-6 -->
   </div>
   <!-- /.row -->

</div>
<!-- /.container-fluid -->
              
            
!

CSS

              
                /* Use this if you need 5 columns */
@media (max-width:575px) {
   .row-5 {
      display: block;
   }
}

/* add width to element with .center-block because its default is 100% */

/* Used for demo purposes */
body {margin:2em 0;}
.row div { margin-bottom:1em;background:orange;opacity:0.4;}
.row div:nth-child(odd) {background-color: orange;}

.row div:after {content: " ";background:#ccc;width:100%;display:block;height:30px;}




              
            
!

JS

              
                
              
            
!
999px

Console