FREE COURSE | BEGINNER
Bootstrap Fundamentals
Build responsive, mobile-first websites using Bootstrap 5.
Learning objectives
Set up Bootstrap, build responsive layouts, use components and utilities, and create a responsive mini project. Basic HTML and CSS knowledge is recommended.
01. Introduction to Bootstrap
Bootstrap is a mobile-first CSS framework. It provides reusable styles and components, reducing the amount of custom CSS needed. Classes are applied directly to HTML elements.
Editable HTML
Live preview
Try it yourself: Change primary to success.
02. Installation and Setup
Include Bootstrap CSS in the head of your HTML document and the JavaScript bundle before the closing body tag. The bundle is needed for interactive components such as collapse and dropdowns. The examples below already load Bootstrap 5.3.3.
Editable HTML
Live preview
Try it yourself: Change text-primary to text-danger.
03. Containers and Grid System
A container wraps rows; rows contain columns. Bootstrap uses a 12-column grid. The class col-md-6 occupies six columns at widths of 768px and above, and stacks below that breakpoint when no smaller column width is specified.
Editable HTML
Live preview
Try it yourself: Resize the preview or change col-md-6 to col-6.
04. Typography, Colors and Utilities
Utility classes apply individual styles: p-3 adds padding, mb-3 adds bottom margin, text-center aligns text, and bg-light sets a light background. Spacing uses a predefined scale.
Editable HTML
Live preview
Try it yourself: Change padding and alignment.
05. Buttons, Cards and Components
Combine btn with a variant such as btn-primary. Cards group related content using card, card-body and card-title.
Editable HTML
Live preview
Try it yourself: Add another button with btn-outline-primary.
06. Navigation and Responsive Design
A navbar can collapse at smaller screen widths. The navbar-expand-md class expands it from the medium breakpoint. The toggler targets a matching collapse element by ID.
Editable HTML
Live preview
Try it yourself: Use the narrow preview and test the menu.
07. Forms and Input Components
Use form-label for labels and form-control for text inputs. Associate labels with input IDs for accessibility. Bootstrap styles forms but does not provide server-side processing.
Editable HTML
Live preview
Try it yourself: Add a labeled name input.
08. Interactive Practice Lab
Combine responsive columns, utilities and cards to create a course catalog. Use col-12 for full width on small screens and col-md-6 for two columns on larger screens.
Editable HTML
Live preview
Try it yourself: Add a third course and try col-md-4.
09. Mini Project: Responsive Website
Build a landing page with a heading, responsive cards and a call to action. Check narrow and wide layouts, keyboard access and readable contrast.
Editable HTML
Live preview
Try it yourself: Customize the portfolio and test both preview widths.