Bootstrap is a popular front-end framework that allows developers to build responsive and visually appealing websites quickly. It provides a set of pre-designed components, such as buttons, forms, and navigation bars, which can be easily customized and integrated into your projects. In this beginner’s guide, we’ll cover the fundamentals of Bootstrap and provide code examples for each step to help you understand the concepts better.

What is Bootstrap?

Bootstrap is an open-source CSS framework developed by Twitter. It aims to simplify the process of web development by providing a collection of reusable HTML and CSS components. With Bootstrap, you don’t have to start from scratch when creating a website. Instead, you can leverage the ready-made components and styles to build responsive and modern web interfaces.

Bootstrap offers many time and effort-saving shortcuts for building web pages. To design responsive, mobile-first, and browser-compatible web pages, all you need is a fundamental understanding of HTML and CSS. This blog will be your ultimate beginner’s guide to bootstrap

P.S. Although Bootstrap is fantastic, it isn’t the best choice for total newbies. Alternatively, you can use a website builder or Word Press to develop a website if you have zero experience using markup. Also, there are numerous free bootstrap templates on the internet that you can use. Some of the websites providing free bootstrap templates are: 


Some points to remember before getting started

1.      You will be needing some prior fundamental level knowledge and understanding of JavaScript, CSS, and HTML before adopting Bootstrap because Bootstrap is built on top of them.

2.      There are numerous versions of Bootstrap, Choose the Bootstrap version you want to work with, we recommend using the latest version. Ensure that you select the version that is best for your project.

3.      Bootstrap can also include the addition of extra code and resources, which may result in a slower website. Utilizing only the components you require and minifying your code will help you improve the performance of your website.

Setting Up Bootstrap

To get started with Bootstrap, you need to include the Bootstrap CSS and JavaScript files in your HTML document. Here’s how you can do it:

  1. Create an HTML file: Start by creating a new HTML file on your computer. You can use any text editor or an integrated development environment (IDE) like Visual Studio Code, Sublime Text, or Atom.
  2. Download Bootstrap: Visit the official Bootstrap website ( and download the latest version of Bootstrap. Choose the compiled CSS and JavaScript files.
  3. Link CSS file: Open your HTML file and add the following code within the <head> section to link the Bootstrap CSS file.
   <link rel="stylesheet" href="path/to/bootstrap.css">
  1. Link JavaScript files: Add the following code at the end of your HTML file, just before the closing </body> tag, to include the Bootstrap JavaScript files.
   <script src="path/to/bootstrap.js"></script>
   <script src="path/to/bootstrap.bundle.js"></script>
  1. Verify the setup: Open your HTML file in a web browser, and you should see the basic styles applied by Bootstrap.

Understanding the Grid System

Bootstrap’s grid system is a powerful feature that helps you create responsive layouts. It consists of a 12-column grid, which you can customize based on your project’s needs. The grid system allows you to divide the page into multiple rows and columns, making it easier to align and position elements on different screen sizes.

The Container Class

Bootstrap uses a container class to wrap the entire content of your website. The container class helps in providing a consistent and structured layout. There are two types of containers in Bootstrap:

  1. Container: The container class creates a fixed-width container that is centered on the page. It has a responsive behavior, which means it adapts to different screen sizes.
   <div class="container">
     <!-- Your content here -->
  1. Container-fluid: The container-fluid class creates a full-width container that spans the entire width of the viewport.
   <div class="container-fluid">
     <!-- Your content here -->

Rows and Columns

Bootstrap’s grid system is based on rows and columns. Each row consists of 12 columns, and you can divide the columns to create different layouts. Here’s how you can create a row and divide it into columns:

  1. Create a row: To create a row, use the `.row` class within a container.
   <div class="container">
     <div class="row">
       <!-- Your columns here -->
  1. Add columns: Within a row, you can add columns by using the .col class. You can specify the number of columns each element should occupy by appending the desired number to the .col class.
   <div class="container">
     <div class="row">
       <div class="col-6">Column 1</div>
       <div class="col-6">Column 2</div>

In this example, both columns occupy 6 columns each, resulting in a two-column layout.

Typography and Styling

Bootstrap provides a set of CSS classes to style your text and add visual elements to your website. Let’s explore some of the commonly used typography and styling classes in Bootstrap.


Bootstrap offers six different heading classes (h1 to h6) to define the hierarchy of your page headings. Here’s an example of how you can use Bootstrap’s heading classes:

<h1 class="display-1">Heading 1</h1>
<h2 class="display-2">Heading 2</h2>
<h3 class="display-3">Heading 3</h3>
<h4 class="display-4">Heading 4</h4>
<h5 class="display-5">Heading 5</h5>
<h6 class="display-6">Heading 6</h6>

Each heading class has a specific size and style associated with it.

Text Styling

Bootstrap provides various classes to style your text. Here are some commonly used text styling classes:

  1. Bold: Use the .font-weight-bold class to make text bold.
   <p class="font-weight-bold">This text is bold.</p>
  1. Italic: Use the .font-italic class to make text italic.
   <p class="font-italic">This text is italic.</p>
  1. Text Color: You can change the color of the text by using color classes, such as .text-primary, .text-success, .text-danger, and so on.
   <p class="text-primary">This text is in primary color.</p>
  1. Text Alignment: Bootstrap provides classes to align text. Use .text-left, .text-center, .text-right, or .text-justify classes for alignment.
   <p class="text-center">This text is centered.</p>
  1. Text Transformation: You can transform text to uppercase or lowercase using .text-uppercase and .text-lowercase classes.
   <p class="text-uppercase">This text is in uppercase.</p>
   <p class="text-lowercase">THIS TEXT IS IN LOWERCASE.</p>

Now that we’ve covered the basics of typography and styling in Bootstrap, let’s move on to working with components.


Bootstrap comes with a wide range of components that you can use to enhance the functionality and aesthetics of your website. From navigation bars to buttons and forms, Bootstrap provides a comprehensive collection of ready-to-use components. In this section, we’ll explore some of the commonly used components and provide code examples for each step.


Buttons are an essential part of any website. Bootstrap offers a variety of button styles that you can easily

customize to match your design. Here’s how you can create different types of buttons using Bootstrap classes:

  1. Primary Button: Use the .btn-primary class to create a primary button.
   <button class="btn btn-primary">Primary Button</button>
  1. Secondary Button: Use the .btn-secondary class to create a secondary button.
   <button class="btn btn-secondary">Secondary Button</button>
  1. Outline Button: To create an outline button, add the .btn-outline-* class along with the desired color class.
   <button class="btn btn-outline-primary">Outline Button</button>
  1. Button Sizes: You can control the size of the buttons by using the .btn-* classes. The available sizes are btn-sm, btn-md, and btn-lg.
   <button class="btn btn-primary btn-sm">Small Button</button>
   <button class="btn btn-primary btn-lg">Large Button</button>

By using these classes, you can easily create visually appealing buttons for your website.


Bootstrap’s form components make it easier to design and validate user input. Let’s take a look at how you can create a basic form using Bootstrap classes:

  1. Form Structure: Start by creating an <form> element with the .form class.
   <form class="form">
     <!-- Form fields here -->
  1. Form Groups: Wrap each form control in a <div> with the .form-group class.
   <div class="form-group">
     <label for="name">Name</label>
     <input type="text" class="form-control" id="name">
  1. Form Controls: Use the .form-control class to style form controls such as text fields, checkboxes, and select boxes.
   <input type="text" class="form-control">
   <input type="checkbox" class="form-control">
   <select class="form-control">
     <option>Option 1</option>
     <option>Option 2</option>
     <option>Option 3</option>

You can further customize these form controls by adding additional classes or attributes.

Navigation Bar

A navigation bar helps users navigate through different sections of a website. Bootstrap provides a responsive and customizable navigation bar component. Here’s how you can create a basic navigation bar using Bootstrap:

  1. Navbar Structure: Start by creating a <nav> element with the .navbar class.
   <nav class="navbar navbar-expand-lg navbar-light bg-light">
     <!-- Navbar content here -->
  1. Navbar Brand: Add a brand logo or name using the .navbar-brand class.
   <a class="navbar-brand" href="#">My Website</a>
  1. Navbar Links: Create navigation links using the .navbar-nav class.
   <ul class="navbar-nav">
     <li class="nav-item active">
       <a class="nav-link" href="#">Home</a>
     <li class="nav-item">
       <a class="nav-link" href="#">About</a>
     <li class="nav-item">
       <a class="nav-link" href="#">Contact</a>


You can further customize the appearance and behavior of the navigation bar by using additional Bootstrap classes and components.


Here’s a small example that combines the code snippets for creating a Bootstrap layout, using typography and styling classes, and implementing components like buttons and forms:

<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Bootstrap Website</title>
  <link rel="stylesheet" href="">
  <div class="container">
    <h1 class="display-1">Welcome to My Website!</h1>
    <p class="font-weight-bold">This is a paragraph with bold text.</p>
    <p class="text-primary">This text is in primary color.</p>
    <div class="row">
      <div class="col-6">
        <button class="btn btn-primary">Click me!</button>
      <div class="col-6">
        <form class="form">
          <div class="form-group">
            <label for="name">Name</label>
            <input type="text" class="form-control" id="name">
          <div class="form-group">
            <label for="email">Email</label>
            <input type="email" class="form-control" id="email">
          <button class="btn btn-secondary">Submit</button>

  <script src=""></script>

In this example, we have a basic Bootstrap layout with a heading, paragraphs with different styling classes, a row with two columns, a primary button, and a form with input fields and a secondary button. You can use this as a starting point and further customize and expand it to fit your specific requirements.

Remember to include the Bootstrap CSS and JavaScript files in your HTML file to ensure that the styles and functionality work correctly.

Frequently Asked Questions (FAQs)

Q1: What is Bootstrap?
Bootstrap is a CSS framework that provides a collection of pre-designed components and styles to build responsive websites quickly.

Q2: How do I include Bootstrap in my project?
To include Bootstrap in your project, download the CSS and JavaScript files from the official Bootstrap website and link them to your HTML file.

Q3: What is the grid system in Bootstrap?
The grid system in Bootstrap is a 12-column layout system that allows you to create responsive and flexible website designs.

Q4: Can I customize the styles of Bootstrap components?
Yes, you can customize the styles of Bootstrap components by overriding the default CSS classes or using custom CSS.

Q5: Are there any alternatives to Bootstrap?
Yes, there are other CSS frameworks available, such as Foundation, Bulma, and Materialize CSS, that offer similar features to Bootstrap.

Q6: Can I use Bootstrap with other front-end frameworks like React or Angular?
Yes, Bootstrap can be used with other front-end frameworks. There are specific libraries and integrations available for popular frameworks like React and Angular.


In this beginner’s guide to Bootstrap, we’ve covered the basics of setting up Bootstrap, understanding the grid system, working with typography and styling, and using components like buttons, forms, and navigation bars. By following the step-by-step instructions and code examples provided, you should now have a solid foundation to start building your own Bootstrap-powered websites.

Remember that practice and experimentation are key to mastering Bootstrap. Explore the official Bootstrap documentation ( and try implementing different components and features in your projects. With time and experience, you’ll become proficient in leveraging the power of Bootstrap to create beautiful and responsive web interfaces.