Slot4,5 Bootstrap
Slot4,5 Bootstrap
JavaScript Components
Objectives
◆ Identify the purpose of using front-end UI frameworks in web design and
development
◆ Set up and Configure project with Bootstrap
◆ Use the Bootstrap grid system to design responsive websites
◆ Recognize how the JavaScript components provide dynamic behavior
◆ Create various navigational elements using Tabs and Accordion
◆ Create modals, tooltips and popovers to reveal content in your website
◆ Build a carousel to show dynamic content on your website
Front-End Web UI Frameworks
What are front-end UI frameworks?
1. Bootstrap 6. Pure
2. Semantic-UI 7. Skeleton
3. Foundation 8. UIKit
4. Materialize 9. Milligram
5. Material UI 10.Susy
Why Front-End Web UI Frameworks?
◆ Cross-browser compatibility
▪ Dealing with quirks of browsers
◆ Increased productivity
▪ Easy to get started
◆ Community support
▪ Resources and web page templates
Introduction to Bootstrap
Bootstrap Overview
▪ https://getbootstrap.com/docs/5.3/layout/grid/
Using BootStrap by CDN
1. Create a new index.html file in your project root.
https://getbootstrap.com/docs/5.3/getting-started/introduction/
Using BootStrap by Terminal
1. Create a folder to hold the files.
2. Initialize a new npm project:
Run the command "npm init -y" to initialize.
◆ Designed to be:
▪ Responsive
▪ Mobile first
▪ Fluid
CSS Flexbox Layout
Equal-width
Add any number of unit-less
classes for each breakpoint
https://getbootstrap.com/docs/5.3/layout/grid/#auto-layout-columns
Responsive classes
All breakpoints
use the .col and .col-*
classes
Stacked to horizontal
Using a single set of .col-sm-*
classes
https://getbootstrap.com/docs/5.3/layout/grid/#responsive-classes
Responsive classes – cont’d
Row columns
Use the responsive .row-
cols-*
https://getbootstrap.com/docs/5.3/layout/grid/#responsive-classes
Nesting column
• To nest content with the default grid, add a new .row and set of .col-sm-*
columns within an existing .col-sm-* column.
Bootstrap Column
Flexbox Alignment
Vertical alignment
Change the vertical alignment with any of
the responsive align-items-* classes
Horizontal alignment
Change the horizontal alignment with any of the
responsive justify-content-* classes.
Flexbox Alignment – cont’d
Column wrapping
If more than 12 columns are placed within a single
row, each group of extra columns will, as one unit,
wrap onto a new line
Column breaks
Breaking columns to a new line in flexbox requires a
small hack: add an element with width: 100%
wherever you want to wrap your columns to a new
line
Reordering
Order classes
• Use .order- classes for
controlling the visual order of
your content. These classes
are responsive, so you can set
the order by breakpoint
(e.g., .order-1.order-md-2).
Reordering – cont’d
Offset classes
• Move columns to the right using .offset-md-* classes. These
classes increase the left margin of a column by * columns.
Reordering – cont’d
Margin utilities
• With the move to flexbox in v4, you can use margin utilities
like .me-auto to force sibling columns away from one another.
Exercise 6: Build website
layout using Bootstrap Grid
Bootstrap JavaScript
Components
Bootstrap and JavaScript
• Custom tooltips
• Directions
https://getbootstrap.com/docs/5.3/components/tooltips/
Popovers
• Popovers are opt-in for performance reasons, so you must initialize them
yourself.
• Zero-length title and content values will never show a popover.
https://getbootstrap.com/docs/5.3/components/popovers/
Modals
• Clicking on the modal “backdrop” will automatically close the modal.
• Bootstrap only supports one modal window at a time. Nested modals
aren’t supported as we believe them to be poor user experiences.
https://getbootstrap.com/docs/5.3/components/modal/
Navbar, Navs & Tabs
• Navbar:
• A common UI component used to create a navigation menu at the top of a
webpage.
• Navs (Navigation):
• Navigation elements used to create a set of links or navigation items within a
webpage. They can be horizontal or vertical and are often placed within a Navbar
or a sidebar.
• Tabs:
• Another type of navigation component that allows users to switch between different
sections or views within a webpage, typically without having to navigate to a new
page. Tabs are often displayed horizontally and consist of clickable labels or tabs
that correspond to different content panels.
Navbar
https://getbootstrap.com/docs/5.3/components/navbar/
Navs & Tabs
https://getbootstrap.com/docs/5.3/components/navs-tabs/
Carousel
https://getbootstrap.com/docs/5.3/components/carousel/
Cards
https://getbootstrap.com/docs/5.3/components/card/
Exercise 7: Demo about Cards Column
Bootstrap Forms
Bootstrap ‘s form controls
• Bootstrap’s form controls expand on our Rebooted form styles with classes. Use these
classes to opt into their customized displays for a more consistent rendering across
browsers and devices.
https://getbootstrap.com/docs/5.3/forms/overview/
Exercise 8: Demo about Form Controls
Lab 2: Build the website
interface
Summary
◆ Concepts were introduced:
◆ Identify the purpose of using front-end UI frameworks in web design and development
◆ Set up and Configure project with Bootstrap
◆ Use the Bootstrap grid system to design responsive websites
◆ Recognize how the JavaScript components provide dynamic behavior
◆ Create various navigational elements using Tabs and Accordion
◆ Create modals, tooltips and popovers to reveal content in your website
◆ Build a carousel to show dynamic content on your website