Back to top

Bootstrap 4

Online Resources

Official Bootstrap Website

Bootsnipp Website

Installing Bootstrap

There are two different ways to include Bootstrap on your website.

  1. Include links to the CDN CSS and Javascript documents in your file.
    • Include the CSS CDN link right above your title in your header.
    • <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
    • Include the Javascript CDN link right before the closing <body> tags. jQuery must come first, then Popper.js and then JavaScript.
    • <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
      <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
      <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
    • Or you can just copy/paste the entire starter code from Bootstrap's website that includes everything including the boilerplate if you are starting from scratch.
  2. Download the Bootstrap file and include in your files.
    • Example: Just download and reference a local file <link rel="stylesheet" type="text/css" href="css/bootstrap4.5.0.css">
    • One disadvantage to this is that no computer can rely on it's cached files to make it faster since so many websites use Bootstrap. This could delay the website rendering a few seconds.

Bootstrap Docs: Navbar

< nav>< /nav> is often used to keep the navbar info.

Add Brand/Logo in navbar

Separate links to right side and logo on left side

Other Items You Can Include in Navbar

Adding Hamburger/Toggler in Navbar

Bootstrap Docs: Toggler

Example of navbar code


Bootstrap Grid Layout System

Bootstrap Docs on Grid System

CSS-Tricks Guide to Flexbox

The mobile-first flexbox grid system uses a twelve column system and five default responsive tiers.

Basic beginner code if you would like two columns:

Containers in Bootstrap

Bootstrap Docs: Containers

Buttons

Bootstrap Docs: Buttons

Bootstrap includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control.

Bootstrap Docs: Carousel

Cards

Bootstrap Docs: Cards

Setting up Cards

If you don't like how the cards don't line up at the bottom,