The Invent with Python Blog

Writings from the author of Automate the Boring Stuff.

Bootstrap 5 Boilerplate Code for New Web Pages

Fri 11 March 2022    Al Sweigart

article header image

Here's the boilerplate that you can copy and paste when creating a new web page with Bootstrap 5.1.3. This comes from the Bootstrap documentation, with some modification to load the icon library as well:

<!doctype html>
<html lang="en">
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

    <!-- Bootstrap Icon library -->
    <link rel="stylesheet" href="[email protected]/font/bootstrap-icons.css" integrity="sha384-He3RckdFB2wffiHOcESa3sf4Ida+ni/fw9SSzAcfY2EPnU1zkK/sLUzw2C5Tyuhj" crossorigin="anonymous">

    <div class="container">
      <div class="row">
        <div class="col">

    <!-- Bootstrap Bundle with Popper -->
    <script src="[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>

I created this for my own use whenever I start a new Bootstrap web page. Feel free to edit as needed. I'll also try to update this page as new versions of Bootstrap come out.

Learn to program for free with my books for beginners:

Sign up for my "Automate the Boring Stuff with Python" online course with this discount link.

Email | Mastodon | Twitter | Twitch | YouTube | GitHub | Blog | Patreon | LinkedIn | Personal Site