ICT245 Web Programming Bootstrap Lecture1 2
ICT245 Web Programming Bootstrap Lecture1 2
Theme 1
Bootstrap Theme 3
Theme 2 PHP
JavaScript
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 2
1
04-Jul-24
Today’s Lecture
1. Overview of Bootstrap
2. Setting up Bootstrap
3. Bootstrap Containers,
Introduction 4. Bootstrap Grid System,
to Bootstrap 5. Bootstrap Typography
6. Bootstrap Tables,
7. Bootstrap Images
8. Bootstrap Alerts
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 3
Lecture Objectives
By the end of the lecture, the student will be able to
1. Explain the Bootstrap framework and its
importance in web development
2. Setup bootstrap for web development
3. Design a Bootstrap 5 web page with key Bootstrap
components and preview in a web browser
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 4
2
04-Jul-24
Introduction to Bootstrap
Bootstrap is a free mobile-first, and responsive front-end web
development framework based on HTML, CSS and JavaScript.
Bootstrap was developed by Mark Otto, and Jacob Thornton
then of Twitter now X in the mid-2010, and was released as an
open-source product in August 2011 on GitHub.
The current version released in 2021 is Bootstrap 5.
The main differences between Bootstrap 5 and Bootstrap 3 & 4,
is that Bootstrap 5 has switched to vanilla JavaScript instead of
jQuery in the earlier versions.
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 6
3
04-Jul-24
4
04-Jul-24
Bootstrap 5 Containers
Bootstrap requires a containing element to wrap the entire contents
of your web page.
Containers are used to wrap the content inside of them, and there are
two container classes available in Bootstrap 5, these are:
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 9
Responsive Containers
Use the .container-sm|md|lg|xl|xxl classes to determine when the
container should be responsive.
The max-width of the container will change on different screen
sizes/viewports.
Source: https://www.w3schools.com/bootstrap5/bootstrap_containers.html
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 10
5
04-Jul-24
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 11
6
04-Jul-24
Source: https://www.w3schools.com/bootstrap5/bootstrap_grid_basic.php
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 13
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 14
7
04-Jul-24
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 15
8
04-Jul-24
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 17
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 18
9
04-Jul-24
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 19
.table-active Grey: Applies the hover color to the table row or table cell
10
04-Jul-24
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 22
11
04-Jul-24
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 23
End of Lecture 1
12
04-Jul-24
Today’s Lecture
1. Bootstrap Alerts
2. Bootstrap Cards
Introduction 3. Bootstrap Collapse
to Bootstrap 4. Bootstrap Nav, and
NavBars
5. Bootstrap Carousels
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 25
Bootstrap 5 Alerts
Alerts are used to display messages that demand users’ attention as a
result of initial user actions.
Bootstrap 5 provides an easy way to create predefined alert messages.
Alerts are created with the .alert as the base class, followed by one of
the contextual classes.
Thus .alert-success, .alert-info, .alert-warning, .alert-danger, .alert-
primary, .alert-secondary, .alert-light or .alert-dark.
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 26
13
04-Jul-24
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 27
Closing Alerts
To close the alert messages, add a .alert-dismissible class to the
alert container.
Then add class="btn-close" and data-bs-dismiss="alert" to a link or
a button element (when you click on this the alert box will
disappear).
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 28
14
04-Jul-24
Bootstrap 5 Cards
A card in Bootstrap 5 is a bordered box with some padding around its
content.
Cards also include options for headers, footers, content, colors etc.
A basic card is created with the .card class, and content inside the card
has a .card-body class.
The .card-header, and .card-footer classes add a heading, and a footer
respectively to the card.
<div class="card">
<div class="card-header">Card Header goes here</div>
<div class="card-body">Card Content goes here</div>
<div class="card-footer">This is the Footer of the Card</div>
</div>
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 29
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 30
15
04-Jul-24
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 31
Card Images
To add an image to a card, use .card-img-top or .card-img-bottom classes in
the <img> tag to place the image at the top or at the bottom of the card
respectively.
Add the image outside of the .card-body to span the entire width.
<div class="card" style="width:400px">
<img class="card-img-top" src="img_avatar1.png"
alt="Card image">
<div class="card-body">
<h4 class="card-title">John Doe</h4>
<p class="card-text">Some example text.</p>
<a href="#" class="btn btn-primary">See Profile</a>
</div>
</div>
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 32
16
04-Jul-24
Bootstrap 5 - Dropdowns
Head to w3schools for Dropdowns
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 33
Bootstrap Collapse
Collapsibles are useful when you want to hide and show large amount
of content on a web page.
The collapse JavaScript plugin is used to show and hide content.
Buttons or anchors are used as triggers that are mapped to specific
elements you toggle.
Collapsing an element will animate the height from its current value
to 0.
Given how CSS handles animations, you cannot use padding on a
.collapse element. Instead, use the class as an independent wrapping
element.
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 34
17
04-Jul-24
The .collapse class indicates a collapsible element (a <div> in our example); this is the content
that will be shown or hidden with a click of a button.
Note: For <a> elements, you can use the href attribute instead of the data-bs-target attribute:
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 35
By default, the content under collapsible object is hidden, you can add
the .show class to show the content by default.
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 36
18
04-Jul-24
Bootstrap Nav
Nav short for navigation is used for creating professional looking menu items on a
web page.
Add the .nav class to a <ul> element, followed by .nav-item for each <li> and add
the .nav-link class to their links for a simple horizontal menu.
<ul class="nav">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Services</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled Link</a>
</li>
</ul>
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 37
Aligning Nav
By default the menu items of a Nav are left-aligned.
You may want to align the menu items to the right or have them
centered.
Use the .justify-content-center class to center the nav, and the
.justify-content-end class to right-align the nav.
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 38
19
04-Jul-24
Turn the nav menu into navigation tabs with the .nav-tabs class,
and add the .active class to the active/current link.
<ul class="nav nav-tabs">
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 39
Bootstrap NavBars
NavBar short for navigation bar is a navigation header that is placed
at the top of a web page.
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 40
20
04-Jul-24
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 42
21
04-Jul-24
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 43
Bootstrap 5 - Carousel
A carousel is a slideshow for cycling through elements especially
images on a web page.
<!-- Carousel -->
<div id="demo" class="carousel slide" data-bs-ride="carousel">
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 44
22
04-Jul-24
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 45
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 46
23
04-Jul-24
.carousel-control-next Adds a right (next) button to the carousel, which allows the user to go forward between the slides
.slide Adds a CSS transition and animation effect when sliding from one item to the next. Remove this
class if you do not want this effect
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 47
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 48
24
04-Jul-24
Bootstrap 5 -- Modal
The Modal component of Bootstrap 5 is a dialog box/popup window
that is displayed on top of the current page.
Head to w3schools.com for code implementations.
Thursday, July 4, 2024 ©2024 - Maxwell Dorgbefu Jnr. ~~ Department of Information Technology Education 49
End of Lecture 2
25