Lesson 1 of 60 – Introduction to Bootstrap
2%

Introduction to Bootstrap

Bootstrap is a popular front-end framework used to create responsive and mobile-first websites quickly. It provides ready-made CSS classes, components, utilities, and JavaScript features that help developers build modern web pages without writing everything from scratch.

Note: Bootstrap is mainly used with HTML, CSS, and JavaScript to create responsive and attractive websites.

1. What is Bootstrap?

Bootstrap is a free and open-source front-end framework for building responsive websites and web applications.

It provides predefined classes for layouts, buttons, forms, navigation bars, cards, alerts, tables, modals, and many other UI elements.

<button class="btn btn-primary">
    Click Me
</button>

2. Why Use Bootstrap?

Bootstrap makes website development faster and easier.

  • Ready-made CSS classes
  • Responsive grid system
  • Pre-designed components
  • Mobile-first design
  • Responsive utilities
  • JavaScript-powered components

3. Bootstrap is a Front-End Framework

Bootstrap is a front-end framework. It works mainly on the part of a website that users see and interact with.

HTML provides the structure, CSS provides styling, and JavaScript provides interactive behavior.

4. Bootstrap is Free

Bootstrap is free to use. Developers can use it for personal projects, educational websites, business websites, and many other web projects.

5. Bootstrap is Open Source

Bootstrap is open-source software. Its source code is publicly available, and developers can use and customize it according to their project needs.

6. Bootstrap and HTML

Bootstrap works together with HTML. Bootstrap classes are added to HTML elements to apply predefined styles.

<h1 class="text-primary">
    Welcome
</h1>

7. Bootstrap and CSS

Bootstrap contains a large collection of CSS rules. Instead of creating every style manually, developers can use Bootstrap classes.

<p class="text-success">
    Success Message
</p>

8. Bootstrap and JavaScript

Some Bootstrap components use JavaScript for interactive behavior. Examples include modals, dropdowns, carousels, tooltips, popovers, offcanvas menus, and collapse components.

9. Responsive Web Design

Responsive web design means creating websites that adjust their layout according to the screen size.

A responsive website can work properly on mobile phones, tablets, laptops, and desktop computers.

10. Mobile-First Approach

Bootstrap follows a mobile-first approach. This means websites are designed to work well on smaller screens first and can then be adapted for larger screens.

11. Bootstrap Grid System

Bootstrap provides a powerful grid system for creating page layouts. The grid is based on rows and columns.

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

12. Bootstrap Containers

Containers are used to provide proper horizontal spacing and control the width of page content.

Common container classes include:

  • .container
  • .container-fluid
  • Responsive container classes

13. Bootstrap Rows

The .row class is used to create a horizontal row in the Bootstrap grid system.

<div class="row">
    ...
</div>

14. Bootstrap Columns

Columns are used to divide a row into different sections.

<div class="row">

    <div class="col">
        Left
    </div>

    <div class="col">
        Right
    </div>

</div>

15. Bootstrap Utility Classes

Bootstrap provides many utility classes that can be used for common styling tasks.

Examples include:

  • mt-3 – margin-top
  • p-3 – padding
  • text-center – center text
  • fw-bold – bold text
  • d-flex – flex display

16. Bootstrap Buttons

Bootstrap provides ready-made button styles using the .btn class.

<button class="btn btn-primary">
    Primary
</button>

<button class="btn btn-success">
    Success
</button>

<button class="btn btn-danger">
    Delete
</button>

17. Bootstrap Colors

Bootstrap provides predefined contextual colors that can be applied to text, buttons, backgrounds, alerts, and other components.

  • Primary
  • Secondary
  • Success
  • Danger
  • Warning
  • Info
  • Light
  • Dark

18. Bootstrap Typography

Bootstrap provides classes for controlling text alignment, font weight, text transformation, headings, and other typography features.

<p class="text-center">
    Center Text
</p>

<p class="fw-bold">
    Bold Text
</p>

19. Bootstrap Cards

Cards are flexible containers used to display related information. They are commonly used for products, courses, profiles, blog posts, and dashboard sections.

<div class="card">
    <div class="card-body">
        <h5>My Course</h5>
        <p>Learn Bootstrap.</p>
    </div>
</div>

20. Bootstrap Alerts

Alerts are used to display important messages to users.

<div class="alert alert-success">
    Registration successful!
</div>

21. Bootstrap Forms

Bootstrap provides classes that make it easier to create attractive and responsive forms.

<input type="text"
class="form-control"
placeholder="Enter Name">

22. Bootstrap Navigation

Bootstrap provides navigation components such as navigation bars, dropdown menus, and responsive navigation systems.

23. Bootstrap Navbar

The navbar component is commonly used for website headers and menus. It can contain a brand name, links, dropdowns, and buttons.

<nav class="navbar navbar-expand-lg
navbar-light bg-light">

    <a class="navbar-brand"
    href="#">
        My Website
    </a>

</nav>

24. Bootstrap Components

Bootstrap provides many ready-made components that reduce development time.

  • Navbar
  • Cards
  • Buttons
  • Alerts
  • Modals
  • Carousel
  • Accordion
  • Dropdowns
  • Pagination

25. Bootstrap Utilities

Utility classes allow developers to quickly apply common CSS properties without writing custom CSS.

<div class="text-center p-4 mt-3">
    Bootstrap Utilities
</div>

26. Bootstrap Icons

Bootstrap Icons is a separate icon library designed to work well with Bootstrap projects. It provides many icons that can be used in buttons, menus, cards, and other interface elements.

27. Bootstrap JavaScript Components

Bootstrap includes interactive components that can be controlled with JavaScript.

Examples include:

  • Modal
  • Carousel
  • Dropdown
  • Collapse
  • Offcanvas
  • Tooltip
  • Popover

28. Bootstrap CDN

A CDN can be used to include Bootstrap files directly in an HTML page without downloading Bootstrap files manually.

A typical Bootstrap project includes the Bootstrap CSS file and, when needed, Bootstrap's JavaScript bundle.

29. Simple Bootstrap Example

<!DOCTYPE html>
<html>
<head>

    <title>Bootstrap Example</title>

    <link
    href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
    rel="stylesheet">

</head>

<body>

<div class="container mt-5">

    <h1 class="text-primary">
        Welcome to Bootstrap
    </h1>

    <p class="lead">
        Learn Bootstrap step by step.
    </p>

    <button class="btn btn-success">
        Get Started
    </button>

</div>

</body>
</html>

This example uses a container, heading, paragraph, text color, spacing utility, and Bootstrap button.

30. Bootstrap Learning Roadmap

To learn Bootstrap effectively, follow these steps:

  1. Understand HTML and CSS basics.
  2. Learn how to include Bootstrap.
  3. Learn containers and the grid system.
  4. Practice rows and columns.
  5. Learn typography and colors.
  6. Practice buttons and alerts.
  7. Learn cards and tables.
  8. Learn forms.
  9. Learn navbar and dropdowns.
  10. Practice Bootstrap components.
  11. Learn utility classes.
  12. Build responsive projects.

By completing this tutorial, you will be able to create responsive websites using Bootstrap components and utility classes.

📌 Key Points

  • Bootstrap is a free and open-source front-end framework.
  • Bootstrap helps create responsive websites quickly.
  • Bootstrap follows a mobile-first approach.
  • The grid system uses rows and columns.
  • Bootstrap provides many ready-made components.
  • Bootstrap provides useful utility classes.
  • Bootstrap can be used with HTML, CSS, and JavaScript.
  • Bootstrap is useful for both beginners and professional developers.

🧠 Quick Quiz

Question: What is Bootstrap?