coreui-free-bootstrap-admin-template
Free Bootstrap Admin & Dashboard Template Built for AI-Assisted Development
- 12k
- HTML
- MIT
- 3 mo ago
Bootstrap-CSS Basics ( v5.x )
Repo learning-zone/bootstrap-css-basics, read from GitHub 1 min ago. learning-zone has not joined Take My Repo.
learning-zone/bootstrap-css-basics is a public repo on GitHub by learning-zone. Bootstrap-CSS Basics ( v5.x ). It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it. It has 88 stars and last changed on 2026-04-15. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-22.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
Click ★ if you like the project. Your contributions are heartily ♡ welcome.
Bootstrap is a front-end framework used for creating HTML, CSS, and JavaScript web applications. Key characteristics:
Here are the reasons to choose Bootstrap for building websites:
1. Mobile-First & Responsive Design
Bootstrap provides full mobile support in a single CSS file. It automatically adjusts layouts based on screen size using a responsive grid system — no separate mobile stylesheet needed.
2. Easy to Learn
If you know basic HTML and CSS, you can start building with Bootstrap quickly using its pre-built class names and components.
3. Cross-Browser Compatibility
Bootstrap supports all major browsers — Chrome, Firefox, Safari, Opera, Edge, and IE — ensuring a consistent look across platforms.
4. Rich Component Library
Bootstrap ships with ready-to-use UI components: navbars, modals, carousels, alerts, buttons, forms, cards, and more — reducing development time significantly.
5. Customizable
You can customize Bootstrap by selecting only the components you need, overriding Sass variables, or using the Utility API (Bootstrap 5) to generate utility classes.
6. Large Community & Ecosystem
Bootstrap has extensive documentation, a large community, and a wide ecosystem of themes and plugins, making it easy to find help and resources.
7. Consistent Design
Using Bootstrap enforces design consistency across pages and team members since everyone works from the same base classes and design tokens.
The key components of Bootstrap are:
| Component | Description |
|---|---|
| CSS | Comes with extensive pre-built CSS files covering typography, tables, forms, buttons, images, and more |
| Scaffolding | Provides the base structure — the 12-column grid system, link styles, and default background |
| Layout Components | Ready-to-use UI components like navbars, panels, wells, jumbotron, breadcrumbs, pagination, badges, and alerts |
| JavaScript Plugins | A collection of jQuery/JavaScript plugins for interactive components — modals, dropdowns, carousels, tooltips, scrollspy, and collapse |
| Customize | Ability to select only the components you need and override variables to generate your own tailored version of the framework |
In Bootstrap 5, the JS plugins were rewritten in vanilla JavaScript, removing the jQuery dependency entirely.
Bootstrap provides two main types of layouts:
1. Fluid Layout — .container-fluid
Spans the full width of the viewport at all screen sizes. Best used when you want the content to take up 100% of the browser width.
<div class="container-fluid"> <div class="row"> <div class="col-md-6">Left</div> <div class="col-md-6">Right</div> </div> </div>
2. Fixed Layout — .container
Has a fixed max-width that changes at each breakpoint, and centers content on the page. The width was traditionally ~940px on standard screens.
<div class="container"> <div class="row"> <div class="col-md-8">Main</div> <div class="col-md-4">Sidebar</div> </div> </div>
.container, .container-fluid, and .container-{breakpoint} in Bootstrap 5?| Class | Behavior |
|---|---|
.container |
Fixed-width, centered; max-width changes at each breakpoint |
.container-fluid |
Always 100% wide across all viewport sizes |
.container-sm |
100% wide below sm (576px), fixed-width at sm and above |
.container-md |
100% wide below md (768px), fixed-width at md and above |
.container-lg |
100% wide below lg (992px), fixed-width at lg and above |
.container-xl |
100% wide below xl (1200px), fixed-width at xl and above |
.container-xxl |
100% wide below xxl (1400px), fixed-width at xxl and above |
<div class="container">Fixed-width centered container</div> <div class="container-fluid">Full-width container</div> <div class="container-md">Full-width on mobile, fixed-width on md+</div>
Bootstrap 5 has six responsive breakpoints based on minimum viewport widths:
| Breakpoint | Class infix | Dimensions |
|---|---|---|
| Extra small | (none) | < 576px |
| Small | sm |
≥ 576px |
| Medium | md |
≥ 768px |
| Large | lg |
≥ 992px |
| Extra large | xl |
≥ 1200px |
| Extra extra large | xxl |
≥ 1400px |
Breakpoints are built with Sass maps and can be customised:
$grid-breakpoints: ( xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px, xxl: 1400px );
A .row is a wrapper for columns inside a .container or .container-fluid. Key rules:
.row-cols-* to set a fixed number of equal-width columns per row.<div class="container"> <div class="row"> <div class="col-md-6">Left half</div> <div class="col-md-6">Right half</div> </div> <!-- Fixed 3 columns per row on any screen size --> <div class="row row-cols-3"> <div class="col">Col 1</div> <div class="col">Col 2</div> <div class="col">Col 3</div> </div> </div>
Gutters are the padding between columns that create spacing in the grid layout. Bootstrap 5 introduced dedicated gutter utility classes:
| Class | Effect |
|---|---|
.g-{size} |
Sets both horizontal and vertical gutters |
.gx-{size} |
Sets horizontal (column) gutters only |
.gy-{size} |
Sets vertical (row) gutters only |
.g-0 |
Removes all gutters |
Sizes range from 0 to 5 (maps to spacing scale: 0 → 4rem).
<!-- No gutters --> <div class="row g-0"> <div class="col">No gutter column</div> </div> <!-- Horizontal gutters only --> <div class="row gx-4"> <div class="col">Column A</div> <div class="col">Column B</div> </div> <!-- Different horizontal and vertical gutters --> <div class="row gx-3 gy-2"> <div class="col-6">Card 1</div> <div class="col-6">Card 2</div> <div class="col-6">Card 3</div> <div class="col-6">Card 4</div> </div>
Use responsive column classes. Apply col-12 for full-width on the smallest screens and col-md-6 (or another breakpoint) for the two-column split on larger screens.
<div class="container"> <div class="row"> <!-- Full-width on xs/sm, half-width on md and above --> <div class="col-12 col-md-6"> <p>Left column content</p> </div> <div class="col-12 col-md-6"> <p>Right column content</p> </div> </div> </div>
On screens narrower than 768 px the two divs stack vertically; at 768 px and wider they sit side by side.
z-index layering system used in layouts?Bootstrap defines a set of z-index values to ensure components overlay each other consistently:
| Component | z-index |
|---|---|
| Dropdown | 1000 |
Sticky elements (.sticky-top) |
1020 |
Fixed elements (.fixed-top, .fixed-bottom) |
1030 |
| Offcanvas backdrop | 1040 |
| Offcanvas | 1045 |
| Modal backdrop | 1050 |
| Modal | 1055 |
| Popover | 1070 |
| Tooltip | 1080 |
| Toast | 1090 |
These values are defined as Sass variables ($zindex-dropdown, $zindex-modal, etc.) and can be customised.
.sticky-top differ from .fixed-top?| Feature | .sticky-top |
.fixed-top |
|---|---|---|
| CSS property | position: sticky |
position: fixed |
| Flow | Remains in normal document flow | Removed from document flow |
| Scroll behavior | Sticks when it reaches the top of the viewport, scrolls with page otherwise | Always fixed at the top regardless of scroll position |
| Space reservation | Space is reserved in layout | No space reserved — content shifts under it |
| Browser support | Modern browsers (IE not supported) | All browsers |
<!-- Sticks to top only when scrolled to its position --> <div class="sticky-top bg-light p-2">Sticky header</div> <!-- Always sits at top of viewport, overlapping content --> <nav class="navbar fixed-top navbar-light bg-light">Fixed Nav</nav>
The Bootstrap Grid System is a 12-column, mobile-first, responsive layout system built on flexbox (Bootstrap 4/5) or floats (Bootstrap 3).
How it works:
.col-md-6 (takes 6 of 12 columns = 50% width).Basic structure:
<div class="container"> <div class="row"> <div class="col-md-4">Column 1 (1/3 width)</div> <div class="col-md-4">Column 2 (1/3 width)</div> <div class="col-md-4">Column 3 (1/3 width)</div> </div> </div>
Grid class tiers (Bootstrap 5):
| Class prefix | Applies from |
|---|---|
.col- |
All screen sizes (< 576px) |
.col-sm- |
≥ 576px |
.col-md- |
≥ 768px |
.col-lg- |
≥ 992px |
.col-xl- |
≥ 1200px |
.col-xxl- |
≥ 1400px |
Key rules:
.row.col (no number) for equal-width auto columnsOffset columns shift a column to the right by a specified number of columns, creating empty space before it — useful for centering columns or creating asymmetric layouts.
Bootstrap 4/5 — use .offset-{breakpoint}-{n}:
<!-- Shifts 3 columns to the right, leaving 3 empty columns on the left --> <div class="container"> <div class="row"> <div class="col-md-6 offset-md-3">Centered column</div> </div> <div class="row"> <div class="col-md-4">Left column</div> <div class="col-md-4 offset-md-4">Right column (pushed right)</div> </div> </div>
.offset-md-3 eats 3 of the 12 available columns.offset-sm-2 offset-md-4).Column ordering lets you change the visual order of columns independently from their order in the HTML source.
Bootstrap 4/5 — use .order-{n} or .order-{breakpoint}-{n}:
<div class="container"> <div class="row"> <div class="col order-3">First in HTML, shown third</div> <div class="col order-1">Second in HTML, shown first</div> <div class="col order-2">Third in HTML, shown second</div> </div> </div>
Responsive ordering:
<div class="row"> <!-- On mobile: shown second. On md+: shown first --> <div class="col-12 col-md-8 order-2 order-md-1">Main content</div> <div class="col-12 col-md-4 order-1 order-md-2">Sidebar</div> </div>
Special order classes:
| Class | Effect |
|---|---|
.order-first |
order: -1 — forces to the very beginning |
.order-last |
order: 6 — forces to the very end |
.order-0 to .order-5 |
Explicit order values |
In Bootstrap, you use the .container class to wrap page content. It creates a centered, fixed-width responsive wrapper.
Three container variants:
<!-- Fixed-width, centers at each breakpoint --> <div class="container"> Page content here </div> <!-- Always 100% wide --> <div class="container-fluid"> Full-width content here </div> <!-- 100% wide until md breakpoint, then fixed-width --> <div class="container-md"> Responsive container </div>
What .container does:
margin: auto15px each side in BS4, 12px in BS5)max-width that steps up at each breakpoint:| Breakpoint | .container max-width |
|---|---|
| xs (< 576px) | 100% |
| sm (≥ 576px) | 540px |
| md (≥ 768px) | 720px |
| lg (≥ 992px) | 960px |
| xl (≥ 1200px) | 1140px |
| xxl (≥ 1400px) | 1320px |
Typical full-page structure:
<body> <nav class="navbar">...</nav> <div class="container"> <div class="row"> <div class="col-md-8">Main content</div> <div class="col-md-4">Sidebar</div> </div> </div> <footer class="container-fluid">...</footer> </body>
Use .container for standard pages, .container-fluid for full-bleed layouts like dashboards sections.
Pagination in Bootstrap is a component used to divide content across multiple pages and provide navigation links between them. It is built using an unordered list (<ul>) styled with Bootstrap classes.
Basic pagination:
<nav aria-label="Page navigation"> <ul class="pagination"> <li class="page-item"><a class="page-link" href="#">Previous</a></li> <li class="page-item"><a class="page-link" href="#">1</a></li> <li class="page-item"><a class="page-link" href="#">2</a></li> <li class="page-item"><a class="page-link" href="#">3</a></li> <li class="page-item"><a class="page-link" href="#">Next</a></li> </ul> </nav>
Classification of pagination classes:
| Class | Purpose |
|---|---|
.pagination |
Applied to <ul> — creates the base pagination component |
.page-item |
Applied to each <li> — wraps each page link |
.page-link |
Applied to each <a> — styles the clickable link |
.active |
Highlights the current page |
.disabled |
Makes a link unclickable (e.g., Previous on first page) |
Sizing variants:
<!-- Large --> <ul class="pagination pagination-lg"> ... </ul> <!-- Default --> <ul class="pagination"> ... </ul> <!-- Small --> <ul class="pagination pagination-sm"> ... </ul>
Active and disabled states:
<ul class="pagination"> <li class="page-item disabled"> <a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a> </li> <li class="page-item"><a class="page-link" href="#">1</a></li> <li class="page-item active" aria-current="page"> <a class="page-link" href="#">2</a> </li> <li class="page-item"><a class="page-link" href="#">3</a></li> <li class="page-item"> <a class="page-link" href="#">Next</a> </li> </ul>
Alignment:
<!-- Left (default) --> <ul class="pagination justify-content-start"> ... </ul> <!-- Center --> <ul class="pagination justify-content-center"> ... </ul> <!-- Right --> <ul class="pagination justify-content-end"> ... </ul>
| Bootstrap | Foundation |
|---|---|
| Bootstrap offers unlimited number of UI elements | In Foundation UI element options are very limited in numbers |
| Bootstraps uses pixels | Foundation use REMs |
| Bootstrap encourages to design for both desktop and mobile. | Foundation encourages to design mobile first |
| Bootstrap support LESS as its preprocessor | Foundation support Sass and Compass as its preprocessor |
In bootstrap you can display code in two ways
tag : If you are going to display code inline, you should use code tag
pre tag: If you want to display the code as a standalone block element or it has multiple lines then you should use pre tag
Bootstrap 4/5 — Basic (vertical) form:
A vertical form stacks labels directly above their inputs, which is the default form layout in Bootstrap.
Steps:
<form> element<div class="mb-3"> (Bootstrap 5) or <div class="form-group"> (Bootstrap 4).form-label to each <label>.form-control to all <input>, <textarea>, and <select> elementsBootstrap 5 example:
<form> <!-- Text input --> <div class="mb-3"> <label for="userName" class="form-label">Full Name</label> <input type="text" class="form-control" id="userName" placeholder="Enter your name"> </div> <!-- Email input --> <div class="mb-3"> <label for="userEmail" class="form-label">Email address</label> <input type="email" class="form-control" id="userEmail" placeholder="name@example.com"> <div class="form-text">We'll never share your email.</div> </div> <!-- Password input --> <div class="mb-3"> <label for="userPassword" class="form-label">Password</label> <input type="password" class="form-control" id="userPassword"> </div> <!-- Textarea --> <div class="mb-3"> <label for="message" class="form-label">Message</label> <textarea class="form-control" id="message" rows="3"></textarea> </div> <!-- Select --> <div class="mb-3"> <label for="country" class="form-label">Country</label> <select class="form-select" id="country"> <option selected>Choose...</option> <option value="1">India</option> <option value="2">USA</option> </select> </div> <!-- Checkbox --> <div class="mb-3 form-check"> <input type="checkbox" class="form-check-input" id="agreeTerms"> <label class="form-check-label" for="agreeTerms">I agree to the terms</label> </div> <button type="submit" class="btn btn-primary">Submit</button> </form>
Key classes:
| Class | Applies to | Purpose |
|---|---|---|
.form-control |
<input>, <textarea> |
Full-width styled input |
.form-select |
<select> |
Styled dropdown |
.form-label |
<label> |
Proper label spacing |
.form-text |
Helper <div>/<span> |
Small hint text below input |
.form-check |
Wrapper <div> |
Checkbox/radio container |
.form-check-input |
<input type="checkbox/radio"> |
Styled checkbox or radio |
.mb-3 |
Wrapper <div> |
Bottom margin between fields |
Bootstrap 4 difference — use .form-group instead of .mb-3:
<div class="form-group"> <label for="email">Email</label> <input type="email" class="form-control" id="email"> </div>
The Modal plugin in Bootstrap is used to create dialog boxes/popup windows that appear on top of the current page — without navigating away — for alerts, confirmations, forms, images, or any custom content.
Basic modal structure:
<!-- Trigger button --> <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal"> Open Modal </button> <!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <!-- Header --> <div class="modal-header"> <h5 class="modal-title" id="myModalLabel">Modal Title</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <!-- Body --> <div class="modal-body"> Modal content goes here... </div> <!-- Footer --> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> </div> </div>
A Bootstrap container is the fundamental layout wrapper that constrains and centers page content horizontally. It is required as the outermost wrapper for the grid system.
Three types:
<!-- Fixed-width: centers content, max-width steps up at each breakpoint --> <div class="container">...</div> <!-- Fluid: always 100% of the viewport width --> <div class="container-fluid">...</div> <!-- Responsive: 100% wide below the breakpoint, fixed-width above it --> <div class="container-md">...</div>
Max-width per breakpoint (.container):
| Breakpoint | Viewport width | Container max-width |
|---|---|---|
| xs | < 576px | 100% |
| sm | ≥ 576px | 540px |
| md | ≥ 768px | 720px |
| lg | ≥ 992px | 960px |
| xl | ≥ 1200px | 1140px |
| xxl | ≥ 1400px | 1320px |
What a container provides:
margin-left: auto; margin-right: autopadding-x)Typical page layout:
<body> <nav class="navbar navbar-expand-lg navbar-dark bg-dark">...</nav> <div class="container my-4"> <div class="row"> <div class="col-md-8">Main content</div> <div class="col-md-4">Sidebar</div> </div> </div> <footer class="container-fluid bg-dark text-white p-4">...</footer> </body>
When to use which:
| Use case | Container type |
|---|---|
| Standard blog/article page | .container |
| Dashboard or admin panel | .container-fluid |
| Full-width hero, narrow body | Mix both |
| Fluid on mobile, fixed on desktop | .container-md / .container-lg |
Bootstrap collapsing elements allow you to show or hide content with a smooth animation — without writing any custom JavaScript.
How it works:
data-bs-toggle="collapse" to the trigger element (button or link)data-bs-target="#id" pointing to the collapsible element.collapse to the element you want to show/hide.show to make it visible by defaultExample:
<!-- Trigger --> <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample"> Toggle Content </button> <!-- Collapsible content --> <div class="collapse" id="collapseExample"> <div class="card card-body"> This content is hidden by default and shown on toggle. </div> </div>
Using a link as trigger:
<a class="btn btn-primary" data-bs-toggle="collapse" href="#collapseExample" role="button"> Toggle </a>
Accordion pattern (only one open at a time):
<div class="accordion" id="accordionExample"> <div class="accordion-item"> <h2 class="accordion-header" id="headingOne"> <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> Section 1 </button> </h2> <div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#accordionExample"> <div class="accordion-body">Content for section 1.</div> </div> </div> <div class="accordion-item"> <h2 class="accordion-header" id="headingTwo"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> Section 2 </button> </h2> <div id="collapseTwo" class="accordion-collapse collapse" data-bs-parent="#accordionExample"> <div class="accordion-body">Content for section 2.</div> </div> </div> </div>
JavaScript API:
const collapseEl = document.getElementById('collapseExample'); const bsCollapse = new bootstrap.Collapse(collapseEl); bsCollapse.show(); // Show the element bsCollapse.hide(); // Hide the element bsCollapse.toggle(); // Toggle visibility
Key classes and attributes:
| Class / Attribute | Purpose |
|---|---|
.collapse |
Hides the element by default |
.collapse.show |
Makes the element visible on load |
.collapsing |
Applied during the transition animation |
data-bs-toggle="collapse" |
Marks the trigger element |
data-bs-target="#id" |
Points to the collapsible element |
data-bs-parent="#id" |
Closes siblings when one opens (accordion) |
List groups are flexible components for displaying a series of content — from simple lists to complex custom content with images, badges, and actions.
Basic list group:
<ul class="list-group"> <li class="list-group-item">Item one</li> <li class="list-group-item">Item two</li> <li class="list-group-item">Item three</li> </ul>
Common use cases:
To add a badge to a list group item, combine flexbox utilities with the .badge component inside the .list-group-item.
Basic badge on a list group item:
<ul class="list-group"> <li class="list-group-item d-flex justify-content-between align-items-center"> Inbox <span class="badge bg-primary rounded-pill">14</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> Notifications <span class="badge bg-danger rounded-pill">3</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> Messages <span class="badge bg-success rounded-pill">7</span> </li> </ul>
How it works:
Class on <li> |
Purpose |
|---|---|
d-flex |
Makes the item a flex container |
justify-content-between |
Pushes text left, badge right |
align-items-center |
Vertically centers both text and badge |
Bootstrap offers various options for styling navigation elements all of them use the same markup and base class .nav.
To create Tabular Navigation or Tabs
Start with a basic unordered list with the base class of .nav
Then add class .nav-tabs
Example:
<ul class="nav"> <li class="nav-item"> <a class="nav-link active" href="#">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="#">About</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Services</a> </li> <li class="nav-item"> <a class="nav-link disabled">Disabled</a> </li> </ul>
The Bootstrap Carousel plugin is used to add an image/content slider to your site. It's ideal when you want to display a large amount of content within a small space on a web page.
It provides the following standard methods:
| Method | Description |
|---|---|
.carousel(options) |
Initializes the carousel with optional configuration |
.carousel('cycle') |
Cycles through carousel items left to right |
.carousel('pause') |
Pauses the carousel cycling |
.carousel('number') |
Cycles to a specific item (0-indexed) |
.carousel('prev') |
Cycles to the previous item |
.carousel('next') |
Cycles to the next item |
It is a flexible, responsive component that supports sliding through images, videos, and other content with navigation controls.
Bootstrap is used for Mobile Web Development because:
Bootstrap's features include:
Additional key components that support these features:
| Component | Description |
|---|---|
| Scaffolding | Grid system, background, and base styles |
| CSS — pre-defined CSS stylesheets for styling | |
| JS Plugins | Built-in JavaScript and jQuery plugins |
| Customizable | Framework can be tailored to project needs |
Bootstrap is built around four core components:
| Component | Description |
|---|---|
| Scaffolding | Grid system, background, and base styles for layout |
| CSS | Pre-defined stylesheets for typography, forms, buttons, tables, etc. |
| JS Plugins | JavaScript and jQuery plugins for interactive components |
| Customize | Ability to configure and extend the framework to match project needs |
Example — using Scaffolding (grid) + CSS + JS together:
<!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6/dist/css/bootstrap.min.css"> </head> <body> <!-- Scaffolding: grid system --> <div class="container"> <div class="row"> <div class="col-md-8">Main content</div> <div class="col-md-4">Sidebar</div> </div> </div> <!-- JS Plugin: modal trigger --> <button class="btn btn-primary" data-toggle="modal" data-target="#myModal"> Open Modal </button> <div class="modal fade" id="myModal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body">Hello from Bootstrap JS Plugin!</div> </div> </div> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.6/dist/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6/dist/js/bootstrap.bundle.min.js"></script> </body> </html>
A Bootstrap container is the fundamental layout element that wraps site content. It provides horizontal padding and centers content on the page, making it responsive.
Bootstrap provides three container variants:
| Class | Behavior |
|---|---|
.container |
Fixed max-width at each breakpoint, centered |
.container-fluid |
Always 100% wide, full viewport width |
.container-{breakpoint} |
100% wide until breakpoint, then fixed |
Example:
<!-- Fixed-width container --> <div class="container"> <p>Content is centered with fixed max-width per breakpoint.</p> </div> <!-- Fluid container (full width) --> <div class="container-fluid"> <p>Content spans the full viewport width.</p> </div> <!-- Responsive container (full width until md, then fixed) --> <div class="container-md"> <p>Full width below md breakpoint, fixed above it.</p> </div>
There are two types of layouts in Bootstrap:
.container-fluid.containerExample:
<!-- Fixed Layout --> <div class="container"> <div class="row"> <div class="col-md-6">Fixed left column</div> <div class="col-md-6">Fixed right column</div> </div> </div> <!-- Fluid Layout --> <div class="container-fluid"> <div class="row"> <div class="col-md-6">Fluid left column</div> <div class="col-md-6">Fluid right column</div> </div> </div>
Fluid Layout is useful when you need an app that spans the full width of the screen. It adjusts itself according to the browser/viewport size using .container-fluid.
Example:
<div class="container-fluid"> <div class="row"> <div class="col-sm-4">Column 1</div> <div class="col-sm-4">Column 2</div> <div class="col-sm-4">Column 3</div> </div> </div>
Fixed layout uses a fixed max-width controlled by .container. Unlike fluid layout it does not span the full browser width — it centers content at predefined widths (e.g., 940px on medium screens).
Example:
<div class="container"> <!-- Centers to 540px on sm, 720px on md, 960px on lg, 1140px on xl --> <div class="row"> <div class="col-md-8">Main content area</div> <div class="col-md-4">Sidebar</div> </div> </div>
You can display code in two ways — using the <code> tag for inline code and using the <pre> tag for multi-line code blocks.
Example:
<!-- Inline code --> <p>Use the <code>console.log()</code> function to print output.</p> <!-- Multi-line code block --> <pre> function greet(name) { return 'Hello, ' + name; } </pre> <!-- Scrollable pre block --> <pre class="pre-scrollable"> .selector { color: red; background: blue; } </pre>
code tag and pre tag?<code> — for short, inline code snippets embedded within a sentence<pre> — for blocks of code with multiple lines that must preserve whitespace and line breaksExample:
<!-- Inline: single expression within text --> <p>The CSS property <code>display: flex</code> enables flexbox layout.</p> <!-- Block: multi-line snippet --> <pre><code>function add(a, b) { return a + b; } console.log(add(2, 3)); // 5 </code></pre>
A progress bar visually represents the progress of a task. Bootstrap uses the HTML5 <progress> concept via CSS classes applied to <div> elements nested inside a .progress wrapper.
Example:
<!-- Basic progress bar --> <div class="progress"> <div class="progress-bar" role="progressbar" style="width: 60%" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"> 60% </div> </div> <!-- Striped and animated --> <div class="progress"> <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 75%"> 75% </div> </div>
The contextual classes used with the progress bar control the color:
| Class | Color |
|---|---|
.progress-bar-success |
Green |
.progress-bar-info |
Blue |
.progress-bar-warning |
Yellow/Orange |
.progress-bar-danger |
Red |
Example:
<div class="progress"> <div class="progress-bar progress-bar-success" style="width: 40%">40% Success</div> </div> <div class="progress"> <div class="progress-bar progress-bar-info" style="width: 60%">60% Info</div> </div> <div class="progress"> <div class="progress-bar progress-bar-warning" style="width: 70%">70% Warning</div> </div> <div class="progress"> <div class="progress-bar progress-bar-danger" style="width: 90%">90% Danger</div> </div>
Responsive utility classes are a set of classes used to show or hide HTML elements based on the current screen resolution, detected via CSS media queries.
Bootstrap 4 display utilities:
| Class | Behavior |
|---|---|
.d-none |
Hidden on all screens |
.d-sm-none |
Hidden on sm and up |
.d-md-none |
Hidden on md and up |
.d-none .d-md-block |
Hidden on xs/sm, visible from md |
Example:
<!-- Hidden on small screens, visible on medium and up --> <div class="d-none d-md-block"> <p>Visible only on md, lg, xl screens.</p> </div> <!-- Visible on small screens only --> <div class="d-block d-md-none"> <p>Visible only on xs and sm screens.</p> </div> <!-- Always hidden --> <div class="d-none">This is never shown.</div>
Bootstrap provides seven built-in button style classes, each mapped to a semantic color:
| Class | Description |
|---|---|
.btn-default |
Default white/grey button |
.btn-primary |
Primary blue action |
.btn-success |
Green for success |
.btn-info |
Light blue for information |
.btn-warning |
Yellow/orange for warnings |
.btn-danger |
Red for destructive actions |
.btn-link |
Styled as a hyperlink |
Example:
<button type="button" class="btn btn-default">Default</button> <button type="button" class="btn btn-primary">Primary</button> <button type="button" class="btn btn-success">Success</button> <button type="button" class="btn btn-info">Info</button> <button type="button" class="btn btn-warning">Warning</button> <button type="button" class="btn btn-danger">Danger</button> <button type="button" class="btn btn-link">Link</button> <!-- Sizing --> <button type="button" class="btn btn-primary btn-lg">Large</button> <button type="button" class="btn btn-primary btn-sm">Small</button>
Bootstrap alerts display contextual feedback messages to the user. They highlight important information with color-coded styling.
Four contextual classes are available: .alert-success, .alert-info, .alert-warning, .alert-danger.
Example:
<div class="alert alert-success" role="alert"> <strong>Well done!</strong> You successfully completed the action. </div> <div class="alert alert-info" role="alert"> <strong>Heads up!</strong> This is an informational message. </div> <div class="alert alert-warning" role="alert"> <strong>Warning!</strong> Please check your input. </div> <div class="alert alert-danger" role="alert"> <strong>Error!</strong> Something went wrong. </div> <!-- Dismissible alert --> <div class="alert alert-warning alert-dismissible fade show" role="alert"> Dismissible warning. <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div>
Bootstrap thumbnails provide a way to lay out images, videos, and text in a grid system. Adding .thumbnail class to an <a> or <div> around an image adds 4px of padding and a grey border.
Example:
<!-- Simple image thumbnail --> <div class="row"> <div class="col-sm-6 col-md-3"> <a href="#" class="thumbnail"> <img src="image.jpg" alt="Thumbnail"> </a> </div> <div class="col-sm-6 col-md-3"> <a href="#" class="thumbnail"> <img src="image2.jpg" alt="Thumbnail"> </a> </div> </div> <!-- Thumbnail with caption --> <div class="col-sm-6 col-md-3"> <div class="thumbnail"> <img src="image.jpg" alt="Photo"> <div class="caption"> <h3>Thumbnail Label</h3> <p>Some description text here.</p> <a href="#" class="btn btn-primary">Button</a> </div> </div> </div>
A modal is a dialog box overlaid on the parent page. It is used to augment the user experience by showing information, forms, or confirmations without navigating away from the page. Modal windows are created with the Bootstrap modal plugin.
Example:
<!-- Trigger button --> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal"> Open Modal </button> <!-- Modal structure --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel">Modal Title</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>Modal body content goes here.</p> </div> <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> </div> </div> </div> </div>
To add pagination to a webpage, use the .pagination class on a <ul> element. Each page item uses .page-item and each link uses .page-link.
Example:
<nav aria-label="Page navigation"> <ul class="pagination"> <li class="page-item disabled"> <a class="page-link" href="#" tabindex="-1">Previous</a> </li> <li class="page-item active"> <a class="page-link" href="#">1</a> </li> <li class="page-item"> <a class="page-link" href="#">2</a> </li> <li class="page-item"> <a class="page-link" href="#">3</a> </li> <li class="page-item"> <a class="page-link" href="#">Next</a> </li> </ul> </nav> <!-- Sizing variants --> <ul class="pagination pagination-lg">...
learning-zone/bootstrap-css-basics is a public repo on GitHub by learning-zone. Bootstrap-CSS Basics ( v5.x ).
It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it.
Its maker tagged it for Windows. That is declared by the maker; Take My Repo has not tested it.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-04-15. GitHub counts 0 open issues and pull requests. Take My Repo does not judge from that whether it is maintained.
Free Bootstrap Admin & Dashboard Template Built for AI-Assisted Development
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Metis - Free Bootstrap 5 Admin Dashboard Template
Important! A new UI Kit version for the latest Bootstrap 5 is available. Access the latest version via the link below
Most Powerful & Comprehensive Free Bootstrap 5 HTML Admin Dashboard Template built for developers! 🚀
The AlgoArena Online Judge is a professional platform for developers, offering prompt code feedback, meticulous test case evaluation, and efficient error highlighting. With tools for tracking execution time and memory usage, it's ideal for honing coding skills.
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/learning-zone/bootstrap-css-basicsTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.