Bootstrap Getting Started

Bootstrap is a popular open-source framework that allows developers to create responsive, mobile-first web pages with ease.

In this guide, we’ll explore how to get started with Bootstrap, how to use it to create a simple website, and some tips for working with the framework.

Table of Contents:

  • Introduction to Bootstrap
  • Setting up a Bootstrap Project
  • Understanding the Bootstrap Grid System
  • Adding Content to Your Bootstrap Page
  • Working with Components in Bootstrap
  • Customizing the Look of Your Bootstrap Site

Introduction to Bootstrap

Bootstrap was developed by Twitter in 2010 as a way to standardize their internal development and make it easier for their team to create consistent, responsive user interfaces.

It quickly became one of the most popular front-end development frameworks and is widely used by developers around the world today.

Bootstrap provides a collection of CSS and JavaScript files that you can use to build your website. It includes a number of pre-designed components, such as buttons, forms, tables, and modals, as well as a grid system that makes it easy to create responsive, mobile-friendly layouts.

Setting up a Bootstrap Project

There are a few different ways to get started with Bootstrap, but the easiest is to include the framework in your project using a CDN (Content Delivery Network).

To do this, simply add the following code to the <head> of your HTML file:

<link rel="stylesheet" href="">
<script src=""></script>
<script src=""></script>
<script src=""></script>

With these lines of code, you now have access to all of the Bootstrap CSS and JavaScript components in your project.

Understanding the Bootstrap Grid System

One of the most important parts of Bootstrap is its grid system. This system allows you to create a flexible, responsive layout for your website, with the ability to change the number of columns based on the screen size.

The Bootstrap grid system is based on 12 columns, which can be divided into any combination of rows and columns.

To create a row, you use the .container class, which sets a fixed width for your content. Within the container, you can create as many columns as you need using the .col- classes.

For example, to create two columns that take up half the width of the container, you would use the following code:

<div class="container">
    <div class="row">
        <div class="col-6">Column 1</div>
        <div class="col-6">Column 2</div>

You can also specify the width of columns based on screen size, by using classes such as .col-sm-.col-md-.col-lg-, and .col-xl-.

For example, to create a column that takes up 6 of the 12 columns on small screens and 4 columns on larger screens, you would use the following code:

<div class="container">
    <div class="row">
        <div class="col-sm-6 col-md-4">Column 1</div>
        <div class="col-sm-6 col-md-8">Column 2</div>

Adding Content to Your Bootstrap Page

Once you have set up your grid system, you can start adding content to your page. Bootstrap provides a variety of pre-designed components that you can use, such as forms, buttons, tables, and modals.

You can also add your own custom HTML and CSS to create unique designs.

For example, to create a simple form with two text inputs and a submit button, you would use the following code:

    <div class="form-group">
        <label for="exampleInputEmail1">Email address</label>
        <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
        <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
    <div class="form-group">
        <label for="exampleInputPassword1">Password</label>
        <input type="password" class="form-control" id="exampleInputPassword1">
    <button type="submit" class="btn btn-primary">Submit</button>

Working with Components in Bootstrap

In addition to pre-designed components, Bootstrap also provides a number of JavaScript plugins that can be used to enhance your site’s functionality.

For example, you can use the Carousel plugin to create a slideshow, the Modal plugin to create pop-up windows, and the Tooltip plugin to add tooltips to your site.

To use these plugins, you’ll need to include the relevant JavaScript files in your project and activate the plugin using JavaScript.

For example, to create a simple modal, you would use the following code:

<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
    Open Modal
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Modal Title</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
            <div class="modal-body">
                Modal Body
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>

Customizing Bootstrap with Your Own Styles

While Bootstrap provides a lot of pre-designed components and styles, you can also customize your site by adding your own styles.

You can either write your own CSS styles or overwrite existing styles by writing styles after including the Bootstrap CSS file.

For example, to change the background color of the body to light grey, you would use the following code:

body {
    background-color: lightgrey;


Getting started with Bootstrap is a great way to create a responsive and functional website quickly and easily.

With its grid system, pre-designed components, and plugins, Bootstrap provides a comprehensive framework for building a wide variety of websites.

Whether you’re a beginner or an experienced developer, Bootstrap is a powerful tool that is definitely worth exploring.

Related Posts: