Skip to main content

Bootstrap Grid CSS

Compiled by Daniel M. Hendricks

npm version MIT License

The grid system extracted from the Bootstrap 4 framework (with CSS wrapper class), compiled into CSS. The responsive utilities from alpha were also ported for convenience.

Intent

I often have to work on web sites that do not have a grid system in place. To minimize time by not reinventing a wheel, I prefer to include a framework for grid tasks.

While there are several grid-only CSS frameworks out there, Bootstrap is convenient if you are familiar with its conventions. However, the full framework also interferes with design. Other frameworks often use generic class names like "row" and "container" without any sort of wrapper to target only those within the grid.

Basic Usage

<div class="bootstrap-wrapper">
  <div class="container-fluid">
    <div class="row">
      <div class="col-sm-4">.col-md-4</div>
      <div class="col-sm-4">.col-md-4</div>
      <div class="col-sm-4">.col-md-4</div>
    </div>
    <div class="row hidden-sm-down"> <!-- Hidden on small screens -->
      <div class="col-md-6">.col-md-6</div>
      <div class="col-md-6">.col-md-6</div>
    </div>
    <div class="row">
      <div class="col-sm-3 col-xs-12"><img src="https://via.placeholder.com/1000x700?text=.img-fluid" class="img-fluid" alt="Responsive Image Demo" /></div>
      <div class="col-sm-3 col-xs-12"><img src="https://via.placeholder.com/1000x700" class="img-fluid" alt="Responsive Image Demo" /></div>
      <div class="col-sm-3 col-xs-12"><img src="https://via.placeholder.com/1000x700?text=.img-fluid" class="img-fluid" alt="Responsive Image Demo" /></div>
      <div class="col-sm-3 col-xs-12"><img src="https://via.placeholder.com/1000x700" class="img-fluid" alt="Responsive Image Demo" /></div>
    </div>
  </div>
</div>

Result

.col-md-4
.col-md-4
.col-md-4
.col-md-6
.col-md-6
Responsive Image Example
Responsive Image Example
Responsive Image Example
Responsive Image Example

Further Reading

For more examples, see the official documentation: