Bootstrap 5
-
HTML - DOM
-
CSS - Sass or Less
-
Bootstrap
Bootstrap -
It is an open source and cross platform library for building effective, responsive UI faster.
-
Library provides a) Utilities b) Components
-
Utilities are used for changing the appearence of any element font, style, color, position, display, margin, padding etc..
-
Components are rich in UI, styles and Logic. Cars, Buttons, Forms, Accordion, Alerts, Modals, Navbar etc...
Alternatives:
TwitterBootstrap
mui [Material UI] - React [Netflix, Facebook, Amazon]
Material UI - Angular
Telerik - JSP, PHP, React, Angular, ASP.NET
DevExpress
jQueryUI
Setup Project
-
Download and Install "Visual Studio Code Editor"
-
Create a folder for project on your PC
D:\Bootstrap-workshop -
Open folder in Visual Studio Code
-
Add folders public : It is for static resources like : html, image, docs src : It is for dynamic resources like: css, js, sass, ts etc..
-
Add a startup page "Index.html" in public folder
-
Test your page by opening with Live Server
[Visual Studio Code - Extentions - Download Live Server Extention]
-
Right Click in HTML page => Open with Live Server | Open In Browser
Enable Bootstrap Icons for your Page --------------------------------------------------- -
Visit the website www.getbootstrap.com
-
Go to "Icons" category and copy its CSS CDN link and paste in your page
Syntax: <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/font/bootstrap-icons.css">
- Bootstrap ICONS are provided as CSS classes, which you can implement
in page.
<span class="bi bi-house">
<span class="bi bi-bell">
<span class="bi bi-facebook">
Ex:
<title>Bootstrap-Workshop</title>Follow us on Facebook Twitter Instagram
Enable Bootstrap Utilities and Components
-
Visit "www.getbootstrap.com"
-
Click on Download
-
Copy CDN links for CSS and jQuery
bootstrap.css bootstrap.bundle.js poper.js [2 components dropdown positions, tooltip]Paste CSS Link in Paste Script Link in
Ex:
<title>Bootstrap-Workshop</title><h1> <span class="bi bi-basket-fill"></span> Shopping Online</h1>
<p>Follow us on <span class="bi bi-facebook"></span> Facebook <span class="bi bi-twitter"></span> Twitter <span class="bi bi-instagram"></span> Instagram</p>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
Summary
-
bootstrap-icons.css ] head
-
bootstrap.min.css ]
-
bootstrap.bundle.min.js ] body
Layout Classes
.container Mobiles 540px .container-sm Tab .container-lg PC [1200px] .container-md PC [1300px] .container-xl Laptop [1400px] .container-xxl Laptop [1600px] .container-fluid Responsive
Box Model Classes
---------------------------
- Box model comprises of 1. margin 2. padding 3. border 4. border-radius 5. width 6. height
Margins: .m margin all directions .ms margin-left [start] [ <5 ml ] .me margin-right[end] .mt margin-top .mb margin-bottom .mx margin-x-axis .my margin-y-axis
Break-Point
{1 to 4}
Syntax:
Ex:
Follow us on Facebook Twitter Instagram
Padding: .p .ps .pe .pt .pb .px .py
Break-Point : {1 to 4}
Border : .border .border-{1 to 3} .border-{primary | danger | success | warning | infor | dark }
Radius : .rounded .rounded-{1 to 3} .rounded-pill .rounded-circle
Width: .w- {25, 50, 75, 100} Height: .h- {25, 50, 75, 100}
Text Colors: .text-{contextual }
Background Color: .bg-{contextual}
Summary
-
Adding CDN Links bootstrap-icons.css bootstrap.css bootstrap.bundle.js
-
Icons classes bi bi-house
-
Bootstrap classes margins padding border rounded width height text color bg color
Display Classes
.d-none display none .d-block display block .d-inline display inline .d-flex display flex
Ex: Inline is applied to elements in container
Ex: Flex is applied to container
<nav class="d-flex">
<div>Home</div>
<div>About</div>
<div>Contact</div>
</nav>
-
Flex can have alignment and direction
.justify-content-between .justify-content-center .justify-content-baseline .align-items-center .align-items-baseline .flex-wrap .flex-row .flex-column
Ex:
FAQ: How to keep any content exaclty center of page? Ans : d-flex, justify-content-center, align-items-center
Ex:
<title>Bootstrap-Workshop</title> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>Ex:
<title>Bootstrap-Workshop</title> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>Ex:
<title>Bootstrap-Workshop</title> Positions
.position-relative .position-fixed .position-absolute .position-static .position-sticky
.top-{0,25,50,75,100} .bottom .start .end
Ex:
<title>Bootstrap-Workshop</title>Ex:
<title>Bootstrap-Workshop</title>- Electronics
- Mobiles
- Televisions
- Watch
- Mobiles
- Televisions
- Watch
- Mobiles
- Televisions
- Watch
- Mobiles
- Televisions
- Watch
- Mobiles
- Televisions
- Watch
- Mobiles
- Televisions
- Watch
- Mobiles
- Televisions
- Watch
- Mobiles
- Televisions
- Watch
- Mobiles
- Televisions
- Watch
- Footwear
- Boots
- Casuals
- Sneakers
- Boots
- Casuals
- Sneakers
- Boots
- Casuals
- Sneakers
- Boots
- Casuals
- Sneakers
- Boots
- Casuals
- Sneakers
- Boots
- Casuals
- Sneakers
- Boots
- Casuals
- Sneakers
- Boots
- Casuals
- Sneakers
- Boots
- Casuals
- Sneakers
Rows and Columns [Grid]
.row .col .col-{1 to 12}
Ex:
- Name
- Nike Casuals
- Price
- 5600.44
- Stock
- Available
Ex:
Summary
-
Display
-
Position
-
Rows and Columns
Font Styles
.fw-bold bold .fst-italic italic .fs-{1 to 6} size
Syntax:
Welcome to Bootstrap
Text Effects
.text-center .text-start .text-end .text-justify .text-{contextual}
Bootstrap Components
- alerts
- Embedded message boxes in page.
- You can control with jQuery attributes
classes: .alert .alert-dismissible .alert-{contextual} .alert-title .alert-subtitle .alert-text .alert-link
attributes: data-bs-dismiss close any component
Ex:
<title>Bootstrap-Workshop</title> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>- Buttons
.btn .btn-{contextual} .btn-outline-{contextual} .btn-group .btn-group-vertical .btn-link .btn-close etc..
Ex:
<title>Bootstrap-Workshop</title> Insert Insert Logout- Cards
.card .card-header .card-body .card-footer .card-title .card-subtitle .card-img-top .card-img-overlay
Ex:
<title>Bootstrap-Workshop</title> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>Forms .form-label .form-control textbox, password, number, date, email, url etc.. .form-select .form-range .form-check-input radio and checkbox .form-switch radio and checkbox as switch
Ex:
<title>Bootstrap-Workshop</title> Input Group
.input-group .input-group-text .input-group-lg
Ex:
<title>Bootstrap-Workshop</title> Modals
.modal .modal-dialog .modal-content .modal-header .modal-body .modal-footer .fade
data-bs-toggle : click data-bs-target : It refers to ID data-bs-dismiss
Ex:
<title>Bootstrap-Workshop</title> Login View Course <div class="modal fade" id="course">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2>UI Technologies</h2>
<button class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-4">
<img src="ui.jpg" width="100" height="100">
</div>
<div class="col-8">
<ol>
<li>HTML</li>
<li>CSS</li>
<li>Bootstrap</li>
<li>JavaScript</li>
</ol>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
Carousel
Basic Classes .carousel .carousel-inner .carousel-item .active : One Item must be active .slide : It defines sliding animation
Attribute data-bs-ride : to start animation
Control Classes .carousel-control-prev .carousel-control-prev-icon .carousel-control-next .carousel-control-next-icon .carousel-dark
Attribute data-bs-slide="prev" data-bs-slide="next" data-bs-target="#bannerId"
Indicator Classes .carousel-indicators .active
Attribute data-bs-slide-to="0"
Timings data-bs-interval="1000" // 1 sec
Ex:
<title>Bootstrap-Workshop</title> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>Ex:
<title>Bootstrap-Workshop</title> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script> Dropdowns
.dropdown .dropup .dropend .dropstart .dropdown-menu .dropdown-item .dropdown-toggle
Ex:
<title>Bootstrap-Workshop</title> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script> Spinners .spinner-grow <title>Bootstrap-Workshop</title> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>




