Bootstrap 5 Foundations
Bootstrap 5 Foundations
Bootstrap 5 Foundations
Enthusiast
Bootstrap 5 Foundations
https://www.therke.com/
Written by Daniel Foreman, 2021
In partnership with CT e Learning
This book was written with the support of https://www.ctelearning.com
for all your career and technical education needs.
The eBook you’ve purchased will prepare you for the bootstrap
section of their courseware. Allowing you to rapidly gain industry
certifications.
Enjoying working from home? Wish to continue remote working for the
duration and after the pandemic? Try the CT e Learning remote
professional freelancer course.
Dedication
To my love Diana, it is for you that I work hard daily.
When I first started learning to develop websites,I took the long way. I
started with HTML5, learned CSS and leapt to JavaScript. I attempted
to work out all the media queries and responsive designs required to
make a modern website work across multiple devices.
https://www.tiktok.com/@therke.com
I also write, host and run the podcast The RKE which you can find on
spotify.
https://open.spotify.com/show/4IfvnRht5hHrelGAddDQ9Z
www.ctelearning.com
https://webprofessionalsglobal.org/
This book will prepare you for the world of responsive mobile first web
design. Teaching the very latest (as of the date of publishing) version
of Bootstrap 5, which you will learn about soon.
You can download the support files for this book from.
www.therke.com
Why be a front-end web developer?
The money, the fame and the power! The understanding of all that is
web, and the ability to understand how the world's largest
interconnected network delivers information to its users worldwide.
The money
The fame
The Power
While all examples are provided in this eBook you may wish to
download the project files at:
https://www.ctelearning.com/b5f
You will need your favourite IDE. I use these cross platform free tools.
https://code.visualstudio.com/
http://brackets.io/
https://atom.io/
http://www.cloudcodepro.com/
https://koderapp.com/
For Android:
https://play.google.com/store/apps/details?
id=com.aor.droidedit&hl=en_GB&gl=US
https://play.google.com/store/apps/details?
id=xyz.iridiumion.enlightened&hl=en&gl=US
https://www.amazon.com/AWD-IDE-Code-Editor-
WEB/dp/B00H5XSUKW
Why Bootstrap 5?
HTML5
HTML Elements
HTML Attributes
Event handlers
CSS3
Class selectors
ID selectors #
Wildcard selectors *
What JavaScript is
What JavaScript is used for
Accessibility
Buttons
Carousels
Forms
Images
Modals
Navigation
Tables
Typography
You should only use 3 if you really want to support old aging web
browsers like Internet Explorer 8 and 9. Some institutions like the
British NHS, which famously still uses Windows XP, do still use these
browsers. If you are doing a job for a client with older browsers who
isn’t willing to update, usage of Bootstrap 3 is best.
jQuery came about in 2006 at a time when browsers did not cooperate
very well with each other. jQuery allowed features to be transferable
between different platforms. Since then web standards and browser
supported features have moved closer together, so it is easier than
ever to use languages like CSS and JavaScript as they were intended.
Since the web has fully evolved past the need for jQuery, it has been
removed from the latest version of Bootstrap.
Getting Started with Bootstrap 5
To make use of Bootstrap 5 you need the following:
Knowledge of HTML5.
Knowledge of classes.
An HTML editor.
You will need to know HTML5 and how to assign class attributes. An
understanding of HTML5 IDs is also useful. You will need to know how
to use a HTML editor and create a basic HTML5 page.
Example 1
<!doctype html>
< html lang="en">
< head >
< title >Minimal HTML5 page</ title >
</ head >
< body >
< h1 >Minimal HTML5 page</ h1 >
< p >This is the minimum code required to hit the HTML5
standards.</ p >
</ body >
</ html >
This is the minimum code we need for a page. Now we are going to
add Bootstrap to the mix.
Example 2
<!doctype html>
< html lang="en">
< head >
< title >Minimal Bootstrap 5 page</ title >
< link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
We add that to the end of our template, before the last </body>
element.
Example 3
<!doctype html>
< html lang="en">
< head >
< title >Minimal Bootstrap 5 page</ title >
< link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
Example 4
<!doctype html>
< html lang="en">
< head >
< title >Minimal Bootstrap 5 page</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Minimal Bootstrap 5 page</ h1 >
< p >This is the minimum code required to hit the HTML5
standards.</ p >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
active
alert
align
badge
bg
blockquote
border
btn
card
carousel
clearfix
close
Col
container
custom
d
display
drop
embed
fade
fixed
float
font
form
has
initialism
input
invalid-feedback
is
justify-content
lead
list
mark
modal
nav
next
no
offset
order
page
position
progress
rounded
row
shadow
sr-only
stretched
success
tab
table
tooltip
visible
was-validated
To use a class with an element you’ll need to use the code < div
class="border"> and insert the class name between the double
quotes. The border class adds a thin border around any element.
Typography
Websites are mostly about the written word, embedded image/ video
and layout. While some interactivity comes along for the ride that
tends to push the art into app development rather than website
development.
The typography section of this eBook will give you everything you
need to make beautiful written content.
Bootstrap Typography.
Styling Techniques.
Whitespace management.
Border control.
Headings Typography
Bootstrap provides classes and styles for all standard HTML heading
levels 1 through 6. These are assigned to standard element selectors
within the Bootstrap framework. Bootstrap uses element selectors to
style the <h1> to <h6> elements.
When using headings, you must maintain the correct structure, and
you must only use a single h1 on a page. The h1 must mirror the
content of the title element.
If you call your page Hotel Destination America, then your first and
only <h1> element must announce the same name. This is because
SEO (search engine optimization) checks to see if they match, which
prevents web developers from misrepresenting the content of their
web page.
In the early days of the web it was possible for a developer selling
tyres to see a trend on the web for a famous singer or actor then write
a title like “You won’t believe what happened to” and then put their tyre
sales page up instead. It was a cheap and easy way to gain traffic to
the site and get some sales.
Example 5
<!doctype html>
< html lang="en">
< head >
< title >Standard Heading's Chrome</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
</ head >
< body >
< h1 >Heading Level 1</ h1 >
< h2 >Heading Level 2</ h2 >
< h3 >Heading Level 3</ h3 >
< h4 >Heading Level 4</ h4 >
< h5 >Heading Level 5</ h5 >
< h6 >Heading Level 6</ h6 >
</ body >
</ html >
The above example does not use Bootstrap in any way. You will see
the browser's native rendering.
Example 6
When we load Bootstrap, which you can see on the right hand side,
Bootstrap automatically styles the h elements, so you don’t need to
use the classes.
As you can see, the Bootstrap headings have less spacing between
them, and a different font. Bootstrap uses a font stack that looks
similar on every major device including Windows, MacOS, iOS,
Android, and Linux.
<!doctype html>
< html lang="en">
< head >
< title >Minimal Bootstrap 5 page</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Heading Level 1</ h1 >
< h2 >Heading Level 2</ h2 >
< h3 >Heading Level 3</ h3 >
< h4 >Heading Level 4</ h4 >
< h5 >Heading Level 5</ h5 >
< h6 >Heading Level 6</ h6 >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
Example 7
<!doctype html>
< html lang="en">
< head >
< title >Heading structure</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet" >
</ head >
< body >
< h1 >Heading Structure</ h1 >
< h2 >Topic 1</ h2 >
< h3 >Topic 1.1</ h3 >
< h4 >Topic 1.1.1</ h4 >
< h4 >Topic 1.1.2</ h4 >
< h5 >Topic 1.1.2.1</ h5 >
< h6 >Topic 1.1.2.1.1</ h6 >
< h3 >Topic 1.2</ h3 >
< h4 >Topic 1.2.1</ h4 >
< h2 >Topic 2</ h2 >
< h3 >Topic 2.1</ h3 >
< h3 >Topic 2.2</ h3 >
< h2 >Topic 3</ h2 >
< h3 >Topic 3.1</ h3 >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body >
</ html >
Heading classes
Example 8
We created a document that uses both the H elements, and a
paragraph with the style applied. As you can see, there is no visual
difference between the two. To indicate the difference between them,
we’ve placed the fake in brackets afterward.
<!doctype html>
< html lang="en">
< head >
< title >Minimal Bootstrap 5 page</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Heading Level 1</ h1 >
< p class="h1">Heading Level 1 (fake)</ p >
< h2 >Heading Level 2</ h2 >
< p class="h2">Heading Level 2 (fake)</ p >
< h3 >Heading Level 3</ h3 >
< p class="h3">Heading Level 3 (fake)</ p >
< h4 >Heading Level 4</ h4 >
< p class="h4">Heading Level 4 (fake)</ p >
< h5 >Heading Level 5</ h5 >
< p class="h5">Heading Level 5 (fake)</ p >
< h6 >Heading Level 6</ h6 >
< p class="h6">Heading Level 6 (fake)</ p >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
It is worth noting that the code used above should not be used. While
they are visually similar, creating a < p class="h1"> would not carry
the same meaning as using a true < h1 > element.
A note about SEO
SEO stands for Search Engine Optimization, and good SEO is the
difference between placing your site at the top of a search engine and
being buried hundreds of results in. If you do not appear on the top or
at least on the first page of a search result then you will receive less
web traffic, no matter how brilliant your site is.
Example 9
We use small because it does not change the meaning of the text in
any meaningful way, nothing is emphasised, and nothing is marked as
important. Splitting the styling can make the heading look more
striking, and separate information that the user needs to know as part
of the title. It is an attention grabber, and engages the reader's interest
by visually separating the information.
<!doctype html>
< html lang="en">
< head >
< title >Secondary headings</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Secondary headings</ h1 >
< h2 >Top Tech Tips < small class="text-muted">for an
amazing tech career</ small ></ h2 >
< p >Getting an amazing tech career will lead to much
happiness!</ p >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
Example 10
Example 11
<!doctype html>
< html lang="en">
< head >
< title >Display Headings</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Heading 1</ h1 >
< h1 class="display-1">Display Heading 1</ h1 >
< h2 >Heading 2</ h2 >
< h2 class="display-2">Display Heading 2</ h2 >
< h3 >Heading 3</ h3 >
< h3 class="display-3">Display Heading 3</ h3 >
< h4 >Heading 4</ h4 >
< h4 class="display-4">Display Heading 4</ h4 >
< h5 >Heading 5</ h5 >
< h5 class="display-5">Display Heading 5</ h5 >
< h6 >Heading 6</ h6 >
< h6 class="display-6">Display Heading 6</ h6 >
</ body >
</ html >
Example 12
If you do decide to mix them, try to keep the layout consistent. For
example, below I’ve only used the display-1 and display-2 classes with
heading level 1 and heading level 2. After that, heading level 3 was
allowed to continue as standard.
This was done because there is a clear hierarchy with the headings,
plus the two promotional texts, what the page is, and which side of the
building the rooms are on are clearly presented. The <h3> elements
and secondary texts are then maintained as normal.
<!doctype html>
< html lang="en">
< head >
< title >Hotel Rooms</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 class="display-1">Hotel Rooms</ h1 >
< p >View our amazing range of hotel rooms!</ p >
It should only be used once per piece of writing, unless that writing is
divided by headings—for example, multiple chapters in an eBook.
Example 13
The lead text is used directly after the heading level announcing the
topic. In this case a heading level <h3> appeared without a display
class. It was then followed by the lead paragraph.
<!doctype html>
< html lang="en">
< head >
< title >Hotel Rooms</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 class="display-1">Hotel Rooms</ h1 >
< p >View our amazing range of hotel rooms!</ p >
< h2 class="display-2">West wing</ h2 >
< h3 >Bay view room < small class="text-muted">£500 + vat</
small ></ h3 >
< p class="lead">Our amazing bay view room, gives views of
the ships coming in and our of the harbour all year long.</ p
>
< p >Our harbour is one of the busiest in the world. View
the worlds fleet come and go about their business.</ p >
< h3 >Magpie view room < small class="text-muted">£350 +
vat</ small ></ h3 >
< p class="lead">Magpies have bold intelligence and
personality, they are known for having chatters whistles
thrills and warbles. Watch these amazing birds from the
comfort of your room.</ p >
< p >Our smaller magpie room, gives views of the migrating
magpies six months of the year.</ p >
< h2 class="display-2">East wing</ h2 >
< h3 >Mountain view room < small class="text-muted">£475 +
vat</ small ></ h3 >
< p class="lead">View our stunning mountain side and the
famous goats that graze upon them!</ p >
< p >Our mountain view room, allows you to spot wild life
with the included telescope.</ p >
< h3 >Magpie view room < small class="text-muted">£300 +
vat</ small ></ h3 >
< p class="lead">Our medium magpie room, gives views of
the migrating magpies six months of the year.</ p >
< p >Magpies have bold intelligence and personality, they
are known for having chatters whistles thrills and warbles.
Watch these amazing birds from the comfort of your room.</ p >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
Example 14
Another example of leading text would be the famous novel The War
of the Worlds , w hich is out of copyright and thus free to use.
This book has one of the most famously quoted opening lines, which
we can highlight in the use of the lead class.
Leading this chapter with that famously quoted opening line helps to
draw the user in.
<!doctype html>
< html lang="en">
< head >
< title >War of the Worlds</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 class="display-1">War of the worlds</ h1 >
< p class="lead">No one would have believed in the last
years of the nineteenth century that this world was being
watched keenly and closely by intelligences greater than
man's and yet as mortal as his own.</ p >
< p >That as men busied themselves about their various
concerns they were scrutinised and studied, perhaps almost as
narrowly as a man with a microscope might scrutinise the
transient creatures that swarm and multiply in a drop of
water. With infinite complacency men went to and fro over
this globe about their little affairs, serene in their
assurance of their empire over matter. It is possible that
the infusoria under the microscope do the same. No one gave a
thought to the older worlds of space as sources of human
danger, or thought of them only to dismiss the idea of life
upon them as impossible or improbable. It is curious to
recall some of the mental habits of those departed days. At
most terrestrial men fancied there might be other men upon
Mars, perhaps inferior to themselves and ready to welcome a
missionary enterprise. Yet across the gulf of space, minds
that are to our minds as ours are to those of the beasts that
perish, intellects vast and cool and unsympathetic, regarded
this earth with envious eyes, and slowly and surely drew
their plans against us. And early in the twentieth century
came the great disillusionment.</ p >
< p >The planet Mars, I scarcely need remind the reader,
revolves about the sun at a mean distance of 140,000,000
miles, and the light and heat it receives from the sun is
barely half of that received by this world. It must be, if
the nebular hypothesis has any truth, older than our world;
and long before this earth ceased to be molten, life upon its
surface must have begun its course. The fact that it is
scarcely one seventh of the volume of the earth must have
accelerated its cooling to the temperature at which life
could begin. It has air and water and all that is necessary
for the support of animated existence.</ p >
</ body >
</ html >
Text Alignment
To align text to left, centre or right gives you the option of visually
styling or aligning your text for formatting and layout reasons. When
using a word processor we have the Align Left, Center and Right Align
options. Bootstrap refers to them a little differently.
Start Align
End Align
Center Align
They are assigned using the classes text-start, text-end and text-
center.
In most word processors there is also the option to fully justify the text.
The problem with the full justify method is that it creates an uneven
spacing between words. There are some users who find this difficult to
read, so the Bootstrap team decided to leave the option out.
Example 15
This paragraph will be aligned to the left like normal, so unless you
have previously used a text alignment this will not change anything.
<!doctype html>
< html lang="en">
< head >
< title >Text Alignment</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet">
</ head >
< body class="p-2">
< h1 class="display-1">Text Alignment</ h1 >
< h2 >Start Aligned</ h2 >
< p class="text-start">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Suspendisse dapibus lobortis
venenatis. Sed risus tortor, aliquet et odio et, auctor
elementum massa. Vivamus tristique libero sit amet placerat
posuere. Pellentesque a est scelerisque, aliquam est ut,
rhoncus odio. Curabitur sed maximus erat. Nam vestibulum non
tortor nec tristique. Nam fringilla rhoncus accumsan.
Vestibulum ante ipsum primis in faucibus orci luctus et
ultrices posuere cubilia curae; Aliquam congue, leo in
fermentum venenatis, lorem nibh tincidunt ipsum, ut euismod
turpis turpis varius odio. Nulla ullamcorper quis metus non
bibendum. In at turpis nec tortor dictum pharetra quis id
ante. Cras ut nisl sagittis, blandit est eu, tincidunt risus.
</ p >
< h2 >Center Aligned</ h2 >
< p class="text-center">Ut eget erat ac felis lacinia
porta a id neque. Mauris sagittis efficitur orci non
interdum. Nulla id augue mauris. Mauris in semper mi,
tincidunt suscipit urna. Integer metus sapien, aliquet quis
sem vel, rutrum aliquam orci. Duis ornare finibus diam a
fermentum. Aenean interdum purus vel aliquam ullamcorper.
Quisque maximus semper libero et convallis. Morbi tristique
lobortis magna, vel varius quam gravida eu. Nunc pharetra leo
nisl, eu convallis sapien viverra quis. Praesent semper, nunc
in vehicula imperdiet, diam erat ullamcorper ipsum, facilisis
faucibus ligula ipsum ut lorem. Fusce sagittis maximus orci
in varius. Integer laoreet viverra tortor. Nulla iaculis
ipsum in nulla pretium accumsan. Suspendisse quis magna
auctor, sodales elit at, rutrum sem. Nullam sit amet orci
tincidunt, ullamcorper mi eget, bibendum massa.</ p >
< h2 >End Aligned</ h2 >
< p class="text-end">Integer quis dignissim leo. Nunc
tincidunt turpis leo, id hendrerit augue lacinia quis.
Maecenas egestas odio turpis, nec rhoncus dolor consectetur
eu. Curabitur ut rutrum tellus. In nisi diam, vestibulum eget
est ut, ultricies euismod ante. Aenean sit amet odio
pulvinar, ornare ante id, sagittis nisi. Phasellus luctus
nisi eu nibh ornare bibendum. Ut porttitor rutrum tortor non
pharetra. Nam eget ligula non urna cursus volutpat. Vivamus
in risus lacinia, fermentum mi molestie, dictum sem.
Suspendisse scelerisque maximus nisl, maximus ullamcorper
ante vulputate vel. Aenean id purus metus. Maecenas sed
mauris sagittis, pulvinar dolor interdum, laoreet ante.
Praesent fermentum commodo elit, vel ullamcorper tortor
sodales placerat. Curabitur ante mauris, elementum quis
mattis eget, suscipit et nisi. Integer vitae dolor
pellentesque, euismod lacus at, molestie ex.</ p >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body >
</ html >
Font Sizing
We can change font sizes inside paragraphs, spans, strong, em, and
other text elements that convey a special meaning, or simply display
text. They can also be used to add a more dramatic appearance to a
piece of text.
If you wish to make a stronger point, you can combine it with the
strong element to embolden and make text stand out. This is good for
warnings and important information.
We access them using the fs-1, fs-2, fs-3, fs-4, fs-5 and fs-6 classes.
The fs-6 class is the base font size—as you decrease the value, the
text becomes larger.
Example 16
When we render the page we have text that looks like this:
The entire source code looks like this.
<!doctype html>
< html lang="en">
< head >
< title >Font Sizing</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body class="p-2">
< h1 class="display-1">Font Sizing</ h1 >
< p class="fs-1">Font Size 1</ p >
< p class="fs-2">Font Size 2</ p >
< p class="fs-3">Font Size 3</ p >
< p class="fs-4">Font Size 4</ p >
< p class="fs-5">Font Size 5</ p >
< p class="fs-6">Font Size 6</ p >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
Example 17
fw-bold
fw-bolder
fw-normal
fw-light
fw-lighter
fst-italic
fst-normal
The fw stands for font weight and refers to the thickness or thinness of
a font. The fst stands for font style.
For sales and marketing, you can style the text to break up the page
to make it more visually interesting and help hold attention. However,
these practices are purely ornamental, and parts of your community
who rely on accessibility tools will not find any inferred meaning
through the use of these styles.
Example 18
The code above demonstrates each of the font weights and styles that
can be used. You should not use italics on its own because this is
included with the EM element. It may confuse users if you style text as
italics, so please avoid doing this.
<!doctype html>
< html lang="en">
< head >
< title >Text Styles</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body class="p-2">
< h1 class="display-1">Text Styles</ h1 >
< h2 >Bold</ h2 >
< p class="fw-bold">The light gray box, lay in front of
the fox.</ p >
< h2 >Bolder</ h2 >
< p class="fw-bolder">The light gray box, lay in front of
the fox.</ p >
< h2 >Normal</ h2 >
< p class="fw-normal">The light gray box, lay in front of
the fox.</ p >
< h2 >Light</ h2 >
< p class="fw-light">The light gray box, lay in front of
the fox.</ p >
< h2 >Lighter</ h2 >
< p class="fw-lighter">The light gray box, lay in front of
the fox.</ p >
< h2 >Italic</ h2 >
< p class="fst-italic">The light gray box, lay in front of
the fox.</ p >
< h2 >Normal font style</ h2 >
< p class="fst-normal">The light gray box, lay in front of
the fox.</ p >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
The lighter fonts can be used as a stylistic choice, but may cause
users who have bad eye-sight to struggle when reading text. It’s best
to avoid it.
Text Line-height
Line-height-sm provides just 1.25 times the height of the text; we don’t
recommend using this.
Meanwhile, if you need extra spacing you can use line-height-lg which
provides 2 times the height of the text.
Example 19
<!doctype html>
< html lang="en">
< head >
< title >Text Line Height</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body class="p-2">
< h1 class="display-1">Text Line Height</ h1 >
< h2 >No height</ h2 >
< p class="lh-1">Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Suspendisse dapibus lobortis venenatis. Sed
risus tortor, aliquet et odio et, auctor elementum massa.
Vivamus tristique libero sit amet placerat posuere.
Pellentesque a est scelerisque, aliquam est ut, rhoncus odio.
Curabitur sed maximus erat. Nam vestibulum non tortor nec
tristique. Nam fringilla rhoncus accumsan. Vestibulum ante
ipsum primis in faucibus orci luctus et ultrices posuere
cubilia curae; Aliquam congue, leo in fermentum venenatis,
lorem nibh tincidunt ipsum, ut euismod turpis turpis varius
odio. Nulla ullamcorper quis metus non bibendum. In at turpis
nec tortor dictum pharetra quis id ante. Cras ut nisl
sagittis, blandit est eu, tincidunt risus.</ p >
< h2 >Small</ h2 >
< p class="lh-small">Ut eget erat ac felis lacinia porta a
id neque. Mauris sagittis efficitur orci non interdum. Nulla
id augue mauris. Mauris in semper mi, tincidunt suscipit
urna. Integer metus sapien, aliquet quis sem vel, rutrum
aliquam orci. Duis ornare finibus diam a fermentum. Aenean
interdum purus vel aliquam ullamcorper. Quisque maximus
semper libero et convallis. Morbi tristique lobortis magna,
vel varius quam gravida eu. Nunc pharetra leo nisl, eu
convallis sapien viverra quis. Praesent semper, nunc in
vehicula imperdiet, diam erat ullamcorper ipsum, facilisis
faucibus ligula ipsum ut lorem. Fusce sagittis maximus orci
in varius. Integer laoreet viverra tortor. Nulla iaculis
ipsum in nulla pretium accumsan. Suspendisse quis magna
auctor, sodales elit at, rutrum sem. Nullam sit amet orci
tincidunt, ullamcorper mi eget, bibendum massa.</ p >
< h2 >Base</ h2 >
< p class="lh-base">Integer quis dignissim leo. Nunc
tincidunt turpis leo, id hendrerit augue lacinia quis.
Maecenas egestas odio turpis, nec rhoncus dolor consectetur
eu. Curabitur ut rutrum tellus. In nisi diam, vestibulum eget
est ut, ultricies euismod ante. Aenean sit amet odio
pulvinar, ornare ante id, sagittis nisi. Phasellus luctus
nisi eu nibh ornare bibendum. Ut porttitor rutrum tortor non
pharetra. Nam eget ligula non urna cursus volutpat. Vivamus
in risus lacinia, fermentum mi molestie, dictum sem.
Suspendisse scelerisque maximus nisl, maximus ullamcorper
ante vulputate vel. Aenean id purus metus. Maecenas sed
mauris sagittis, pulvinar dolor interdum, laoreet ante.
Praesent fermentum commodo elit, vel ullamcorper tortor
sodales placerat. Curabitur ante mauris, elementum quis
mattis eget, suscipit et nisi. Integer vitae dolor
pellentesque, euismod lacus at, molestie ex.</ p >
< h2 >Large</ h2 >
< p class="lh-large">Nunc vitae tortor maximus, accumsan
ante ac, auctor neque. Praesent in commodo enim. Ut id sapien
lobortis, porttitor sapien ut, blandit nulla. Sed pharetra
luctus faucibus. Nullam pellentesque fermentum neque vitae
mattis. Vivamus scelerisque congue nibh vitae vulputate. Nunc
accumsan, justo a porttitor tincidunt, nulla purus elementum
risus, a interdum sapien enim nec mi. Pellentesque habitant
morbi tristique senectus et netus et malesuada fames ac
turpis egestas. Nullam non lectus luctus, ultrices libero
eget, mattis elit. Morbi laoreet metus vitae tempor aliquam.
Maecenas sit amet tellus elit. Cras commodo vel felis vel
vehicula. Nullam ultrices imperdiet vulputate. Donec
hendrerit egestas erat, et condimentum mauris ornare eget.
Pellentesque tristique, magna venenatis maximus sollicitudin,
odio quam tincidunt magna, vel aliquet ligula arcu a velit.</
p>
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
Text Transform
This last point is probably the most important—we need to ensure that
anyone who visits a website can fully understand it. Keeping language
as simple as possible and using the standard rules of English,
combined with base font sizes and line heights, dramatically improves
the readability of your content.
Some even find that big bold capital headings distract from the content
they came to consume.
text-lowercase
text-uppercase
text-capitalise
You will notice in this book that all the cases are lower, because in
programming you need to use the right case or it will not work. This is
an example of using lowercase.
Example 20
The use of the classes is relatively simple, and we’ve applied it to the
three paragraphs in this example.
<!doctype html>
< html lang="en">
< head >
< title >Text Transform</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body class="p-2">
< h1 class="display-1">Text Transform</ h1 >
< h2 class="text-lowercase">Lowercase</ h2 >
< p class="text-lowercase">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Suspendisse dapibus lobortis
venenatis. Sed risus tortor, aliquet et odio et, auctor
elementum massa. Vivamus tristique libero sit amet placerat
posuere. Pellentesque a est scelerisque, aliquam est ut,
rhoncus odio. Curabitur sed maximus erat. Nam vestibulum non
tortor nec tristique. Nam fringilla rhoncus accumsan.
Vestibulum ante ipsum primis in faucibus orci luctus et
ultrices posuere cubilia curae; Aliquam congue, leo in
fermentum venenatis, lorem nibh tincidunt ipsum, ut euismod
turpis turpis varius odio. Nulla ullamcorper quis metus non
bibendum. In at turpis nec tortor dictum pharetra quis id
ante. Cras ut nisl sagittis, blandit est eu, tincidunt risus.
</ p >
< h2 class="text-uppercase">Uppercase</ h2 >
< p class="text-uppercase">Ut eget erat ac felis lacinia
porta a id neque. Mauris sagittis efficitur orci non
interdum. Nulla id augue mauris. Mauris in semper mi,
tincidunt suscipit urna. Integer metus sapien, aliquet quis
sem vel, rutrum aliquam orci. Duis ornare finibus diam a
fermentum. Aenean interdum purus vel aliquam ullamcorper.
Quisque maximus semper libero et convallis. Morbi tristique
lobortis magna, vel varius quam gravida eu. Nunc pharetra leo
nisl, eu convallis sapien viverra quis. Praesent semper, nunc
in vehicula imperdiet, diam erat ullamcorper ipsum, facilisis
faucibus ligula ipsum ut lorem. Fusce sagittis maximus orci
in varius. Integer laoreet viverra tortor. Nulla iaculis
ipsum in nulla pretium accumsan. Suspendisse quis magna
auctor, sodales elit at, rutrum sem. Nullam sit amet orci
tincidunt, ullamcorper mi eget, bibendum massa.</ p >
< h2 class="text-capitalize">capitalize</ h2 >
< p class="text-capitalize">integer quis dignissim leo.
Nunc tincidunt turpis leo, id hendrerit augue lacinia quis.
Maecenas egestas odio turpis, nec rhoncus dolor consectetur
eu. Curabitur ut rutrum tellus. In nisi diam, vestibulum eget
est ut, ultricies euismod ante. Aenean sit amet odio
pulvinar, ornare ante id, sagittis nisi. Phasellus luctus
nisi eu nibh ornare bibendum. Ut porttitor rutrum tortor non
pharetra. Nam eget ligula non urna cursus volutpat. Vivamus
in risus lacinia, fermentum mi molestie, dictum sem.
Suspendisse scelerisque maximus nisl, maximus ullamcorper
ante vulputate vel. Aenean id purus metus. Maecenas sed
mauris sagittis, pulvinar dolor interdum, laoreet ante.
Praesent fermentum commodo elit, vel ullamcorper tortor
sodales placerat. Curabitur ante mauris, elementum quis
mattis eget, suscipit et nisi. Integer vitae dolor
pellentesque, euismod lacus at, molestie ex.</ p >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
Underline strikethrough and removal of underline.
It is worth noting that the element STRIKE exists to do the same job,
and you should use this instead of using the Bootstrap style. The class
is useful for HTML 4.01 where strike didn’t exist.
text-decoration-underline
text-decoration-line-through
text-decoration-none
<!doctype html>
< html lang= "en" >
< head >
< title > Underline strikethrough and removal of underline
</ title >
< meta charset= "utf-8" >
< meta name= "viewport" content= "width=device-width,
initial-scale=1" >
< link href=
"https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel= "stylesheet" >
</ head >
< body class= "p-2" >
< h1 class= "display-1" > Underline strikethrough and
removal of underline </ h1 >
< h2 > A underlined piece of text. </ h2 >
< p > This is some underlined text < span class= "text-
decoration-underline" > as you can see </ span > it looks
like a hyperlink. </ p >
< h2 > A paragraph with updated information. </ h2 >
< p > The meeting will be held at < span class= "text-
decoration-line-through" > 10pm on 11th May </ span > 11pm on
10th May please be there early. </ p >
< h2 > A paragraph with updated information. </ h2 >
< p > The meeting will be held at < strike > 10pm on 11th
May </ strike > 11pm on 10th May please be there early. </ p >
< h2 > A hyperlink with underline removed </ h2 >
< p > To obtain the special offer click < a href=
"www.ctelearning.com" class= "text-decoration-none" > CT < sup
> e </ sup > Learning </ a > and gain 10% off! </ p >
< script src=
"https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js" ></ script >
</ body >
</ html >
You will notice no visual difference between the strike element and the
styling class.
Lists
Lists are used everyday for organising information. They are used in
surprising places.
The first is to organise data and display it to the user. For these you
just need to use the usual <ul> and <ol> elements. Bootstrap will
automatically style these without the need for classes.
The second is to organise elements within the page. Lists of links are
a common use for this. You can also list UI elements such as radio
buttons, checkboxes, and others.
We use the class list-unstyled with the <ul> element to remove the
bullet points you would otherwise have. This can be commonly used in
footers where you want to list your website or social media links.
Then we have the class list-inline, which are used when making a list
that appears on the same line as everything else. This is commonly
used in the nav bar at the top of the website.
The list-inline gets applied to a single group of list items, then list-
inline-item gets applied to every <li> element within that group to
ensure they appear on the same line.
Example 22
The example below shows the classes in use. We have four sections
—unstyled list of social media links, unstyled list of checkboxes, an
inline list of menu links and a normal unstyled list.
<!doctype html>
< html lang="en">
< head >
< title >Lists</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet" >
</ head >
< body class="p-2">
< h1 class="display-1">Lists</ h1 >
< h2 >Unstyled List</ h2 >
< ul class="list-unstyled">
< li >< a href="#">Twitter</ a ></ li >
< li >< a href="#">LinkedIn</ a ></ li >
< li >< a href="#">Facebook</ a ></ li >
< li >< a href="#">YouTube</ a ></ li >
</ ul >
< h2 >Unstyled List Checkbox</ h2 >
< ul class="list-unstyled">
< li >< label >Option 1</ label > < input
type="checkbox"></ li >
< li >< label >Option 2</ label > < input
type="checkbox"></ li >
< li >< label >Option 3</ label > < input
type="checkbox"></ li >
< li >< label >Option 4</ label > < input
type="checkbox"></ li >
</ ul >
< h2 >Inline List</ h2 >
< ul class="list-inline">
< li class="list-inline-item">< a href="#">Home</ a ></
li >
< li class="list-inline-item">< a href="#">Services</
a ></ li >
< li class="list-inline-item">< a href="#">About</ a >
</ li >
< li class="list-inline-item">< a href="#">Help</ a ></
li >
</ ul >
< h2 >Normal</ h2 >
< ul >
< li >Eggs</ li >
< li >Milk</ li >
< li >Bread</ li >
< li >Cheese</ li >
</ ul >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body ></ html >
Bootstrap Colours
Colours can be added to Bootstrap using CSS and writing your own
classes. Bootstrap comes with a series of predefined colours that
convey specific meanings. The reason for doing this is that a standard
is set and people can identify different information using colour.
Primary
Secondary
Success
Danger
Warning
Info
Dark
Light
The primary colour blue conveys its presence through colour and is
typically used on buttons and UI elements that perform an action.
Secondary colours are more muted and less obvious and are used on
secondary UI elements.
Success colours indicate that a positive action has taken place. For
example, a message stating that a mail has gone through, or an action
has taken place.
The danger colour is for critical errors, critical issues and critical
information such as health and safety notices. It can be as simple as a
mail failed to send a message. Or a notice warning that a certain
action will cause personal injury.
Dark and Light are used to colour text and backgrounds for large
contrasts. They are typically used as background and foreground
colours.
Example 23
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Colours</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body class="p-2">
< h1 class="display-1">Bootstrap Colours</ h1 >
< h2 >Standard Colours</ h2 >
< div class="row">
< div class="col-sm-4 bg-primary text-light">
< p >Primary</ p >
</ div >
< div class="col-sm-4 bg-secondary text-light">
< p >Secondary</ p >
</ div >
< div class="col-sm-4 bg-success text-light">
< p >Success</ p >
</ div >
</ div >
< div class="row">
< div class="col-sm-4 bg-danger text-light">
< p >Danger</ p >
</ div >
< div class="col-sm-4 bg-warning text-dark">
< p >Warning</ p >
</ div >
< div class="col-sm-4 bg-info text-dark">
< p >Info</ p >
</ div >
</ div >
< div class="row">
< div class="col-sm-6 bg-dark text-light">
< p >Dark</ p >
</ div >
< div class="col-sm-6 bg-light text-dark">
< p >Light</ p >
</ div >
</ div >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body ></ html >
Borders
Border will simply place a solid black line around a block element.
Border can be applied to the top, bottom, start and end of a block.
border-top
border-bottom
border-start
border-end
The start and end refer to left and right, in that order.
border-primary
border-secondary
border-success
border-warning
border-danger
border-dark
border-light
border-info
Example 24
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap border with colours</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet" >
</ head >
< body class="p-2">
< h1 >Bootstrap border with colours</ h1 >
< div class="border border-primary m-2">The primary colour
full border</ div >
< div class="border-start border-secondary m-2">The
secondary colour start border</ div >
< div class="border-end border-success m-2">The success
colour end border</ div >
< div class="border-bottom border-warning m-2">The warning
colour bottom border</ div >
< div class="border-top border-danger m-2">The danger
colour top border</ div >
< div class="border-start border-end border-info m-2">The
info colour start and end border</ div >
< div class="border-bottom border-top border-dark m-2">The
dark colour top and bottom border</ div >
< div class="border-end border-start border-top border-
bottom border-light m-2">The light colour top bottom start
end border</ div >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body ></ html >
Example 25
border-1
border-2
border-3
border-4
border-5
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap border thickness</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width, initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet" >
</ head >
< body class="p-2">
< h1 >Bootstrap border with colours</ h1 >
< div class="border border-1 m-2">Border with thickness 1</
< div class="border border-2 m-2">Border with thickness 2</
< div class="border border-3 m-2">Border with thickness 3</
< div class="border border-4 m-2">Border with thickness 4</
< div class="border border-5 m-2">Border with thickness 5</
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body ></ html >
Margins are the space around the border of a block element. The
bigger the margin, the more space is assigned.
Margins are called using the m-1, m-2, m-3, m-4, and m-5 classes. M-
1 is the smallest margin and m-5 is the largest.
Example 26
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap margins</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css">
</ head >
< body class="p-2">
< h1 >Bootstrap margins</ h1 >
< div class="border m-1">Border with thickness 1</ div >
< div class="border m-2">Border with thickness 2</ div >
< div class="border m-3">Border with thickness 3</ div >
< div class="border m-4">Border with thickness 4</ div >
< div class="border m-5">Border with thickness 5</ div >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body ></ html >
Example 27
You can control the direction of the margin, assigning it to top, bottom,
start and end as you do with borders.
m-*
ms-*
me-*
my-*
mx-*
mt-*
mb-*
The m-* class sets the complete margin border, the ms-* sets the left
margin, me-* sets the right, mt-* sets top, mb-* sets bottom, mx-* sets
both start and end at the same time while my-* sets the top and
bottom at the same time.
<!doctype html>
< html lang="en">
< head >
< title >Button Groups</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body class="p-2">
< h1 class="display-1">Button Groups</ h1 >
< div class="btn-group" role="group" aria-label="Basic
example">
< button type="button" class="btn btn-primary">Left</
button >
< button type="button" class="btn btn-
success">Middle</ button >
< button type="button" class="btn btn-warning">Right</
button >
</ div >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body ></ html >
Padding
Padding is the space between the border and the text, image, or of a
block element.
Padding moves text and other elements like blocks, images, video,
etc., away from the border of an element, even if the border is not
visible. It stops text from being too close to border walls.
Margins are called using the p-1, p-2, p-3, p-4, and p-5 classes. The
p-1 is the smallest margin and p-5 is the largest.
Example 28
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Padding</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width, initial-
scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-
eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
crossorigin="anonymous">
</ head >
< body class="p-2">
< h1 >Bootstrap Padding</ h1 >
< div class="border p-1">Padding 1</ div >
< div class="border p-2">Padding 2</ div >
< div class="border p-3">Padding 3</ div >
< div class="border p-4">Padding 4</ div >
< div class="border p-5">Padding 5</ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js" integrity="sha384-
JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
crossorigin="anonymous"></ script >
</ body ></ html >
Example 29
m-*
ms-*
me-*
my-*
mx-*
mt-*
mb-*
The p-* class sets the complete padding border, the ps-* sets the left
padding, pe-* sets the padding right, pt-* sets padding top, pb-* sets
bottom, px-* sets both start and end at the same time while mpy-* sets
the top and bottom at the same time.
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap padding direction</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet">
</ head >
< body class="p-2">
< h1 >Bootstrap padding</ h1 >
< div class="border p-5">Padding all</ div >
< div class="border pt-5">Padding top</ div >
< div class="border pb-5">Padding bottom</ div >
< div class="border ps-5">Padding start</ div >
< div class="border pe-5">Padding end</ div >
< div class="border px-5">Padding X</ div >
< div class="border py-5">Padding Y</ div >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body ></ html >
Bootstrap Buttons
The button is initially set up with the btn class, then a colour is
assigned using the standard colour names.
Btn-primary
Btn-secondary
Btn-success
Btn-danger
Btn-warning
Btn-info
Btn-dark
Btn-light
The colour of the text inside the button is selected using the text-*
class, which accepts the same standard Bootstrap colour names.
In addition to this we have btn-link, which makes the button look like a
standard hyperlink—however, it is rarely used. The <a> element
performs this action with the same styling, though it is not a block
element.
Example 30
We simply create a button element and assign a class with btn and
then btn-[colour].
<!doctype html>
< html lang="en">
< head >
< title >Buttons</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body class="p-2">
< h1 class="display-1">Buttons</ h1 >
< button type="button" class="btn btn-primary">Primary</
button >
< button type="button" class="btn btn-
secondary">Secondary</ button >
< button type="button" class="btn btn-success">Success</
button >
< button type="button" class="btn btn-danger">Danger</
button >
< button type="button" class="btn btn-warning">Warning</
button >
< button type="button" class="btn btn-info">Info</ button >
< button type="button" class="btn btn-light">Light</
button >
< button type="button" class="btn btn-dark">Dark</ button >
< button type="button" class="btn btn-link">Link</ button >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body ></ html >
Example 31
We can group buttons together so that they form a united panel. This
is useful when we want controls or buttons presented as a choice
rather than individual options.
The buttons are placed in a single div that is given the class btn-
group, then the buttons are created as normal. Rather than being
separated from one another, they appear side by side.
<!doctype html>
< html lang="en">
< head >
< title >Button Groups</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body class="p-2">
< h1 class="display-1">Button Groups</ h1 >
< div class="btn-group" role="group" aria-label="Basic
example">
< button type="button" class="btn btn-primary">Left</
button >
< button type="button" class="btn btn-
success">Middle</ button >
< button type="button" class="btn btn-warning">Right</
button >
</ div >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body ></ html >
Bootstrap Buttons with outlines
The outline button is initially set up with the btn class, then a colour is
assigned using the standard colour names.
Btn-outline-primary
Btn-outline-secondary
Btn-outline-success
Btn-outline-danger
Btn-outline-warning
Btn-outline-info
Btn-outline-dark
Btn-outline-light
The colour of the text inside the button is the same as the outline of
the button. It can be changed independently but this would adjust the
meaning of the button, so it is better to leave it consistent. A success
border with a danger colour text, for example, would be very
confusing.
Example 32
<!doctype html>
< html lang="en">
< head >
< title >Button Outlined</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet">
</ head >
< body class="p-2">
< h1 class="display-1">Button Outlined</ h1 >
< button type="button" class="btn btn-outline-
primary">Primary</ button >
< button type="button" class="btn btn-outline-
secondary">Secondary</ button >
< button type="button" class="btn btn-outline-
success">Success</ button >
< button type="button" class="btn btn-outline-
danger">Danger</ button >
< button type="button" class="btn btn-outline-
warning">Warning</ button >
< button type="button" class="btn btn-outline-info">Info</
button >
< button type="button" class="btn btn-outline-
light">Light</ button >
< button type="button" class="btn btn-outline-dark">Dark</
button >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body ></ html >
Example 33
We can group buttons together so that they form a united panel. This
is useful when we want controls or buttons presented as a choice
rather than individual options.
The buttons are placed in a single div that is given the class btn-
group, then the buttons are created as normal. Rather than being
separate from one another, they appear side by side.
<!doctype html>
< html lang="en">
< head >
< title >Grouped Button Outlined</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet">
</ head >
< body class="p-2">
< h1 class="display-1">Grouped Button Outlined</ h1 >
< div class="btn-group" role="group" aria-label="Basic
outlined example">
< button type="button" class="btn btn-outline-
primary">Left</ button >
< button type="button" class="btn btn-outline-
success">Middle</ button >
< button type="button" class="btn btn-outline-
danger">Right</ button >
</ div >
< script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body ></ html >
End of section activity
You have everything you need to create beautiful blog posts, eBooks,
articles, and more besides.
Imagine what you might use a website for and then sit down and write
the content part of that site.
Website Layouts
The Footer
Rows.
Columns
Breakpoints.
Whitespace management.
Gutter control.
Bootstrap Containers
Bootstrap containers are the most basic layout tool available to the
framework. There are two types available, and their purpose is to
contain and separate parts of your website or application.
Example 34
540px
720px
960px
1140px
1320px
Essentially, these are the widths that the container snaps too.
Between snaps it centers the container to the browser viewport.
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Container</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width, initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymou
</ head >
< body >
< h1 >Bootstrap Container</ h1 >
< p >The div below has container, and border classes attached.</
< div class="container border">100% wide until small breakpoint</
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></
</ body ></ html >
Bootstrap containers with breakpoints
container-sm
container-md
container-lg
container-xl
container-xxl
The classes work in the same way as the normal container; however,
the way they snap to resolutions is different.
Example 35
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Container with breakpoint</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Bootstrap Container with breakpoint</ h1 >
< p >The div below has container, and border classes
attached.</ p >
< div class="container border">100% wide until small
breakpoint</ div >
< div class="container-sm border">100% wide until small
breakpoint</ div >
< div class="container-md border">100% wide until medium
breakpoint</ div >
< div class="container-lg border">100% wide until large
breakpoint</ div >
< div class="container-xl border">100% wide until extra
large breakpoint</ div >
< div class="container-xxl border">100% wide until extra
extra large breakpoint</ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body ></ html >
Fluid Container
Example 36
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Fluid Container</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Bootstrap Fluid Container</ h1 >
< p >The div below has container, and border classes
attached.</ p >
< div class="container border">100% wide until small
breakpoint</ div >
< div class="container-sm border">100% wide until small
breakpoint</ div >
< div class="container-md border">100% wide until medium
breakpoint</ div >
< div class="container-lg border">100% wide until large
breakpoint</ div >
< div class="container-xl border">100% wide until extra
large breakpoint</ div >
< div class="container-xxl border">100% wide until extra
extra large breakpoint</ div >
< div class="container-fluid border">< strong >100% wide
with no breakpoints</ strong ></ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body ></ html >
Bootstrap Grid System
Unlike a table you have a system where you can create as many rows
as you like, but are limited to twelve columns.
Example 37
To create a row, we use the class row , and place it inside the class
container .
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Container and Row</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width, initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymou
</ head >
< body >
< h1 >Bootstrap Container and Row</ h1 >
< p >The div below has container, and border classes attached.</
< div class="container">
< span >This is the container. It controls the width of the elemen
span >
< div class="row border">This is a row, this is a layout tool for
elements within a container.</ div >
</ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></
</ body ></ html >
A row will snap to the width of the container. If you use container-fluid
it will extend across the entire width of the document.
Example 38
If you wish to have several pieces of content side by side in the same
row, use the class col .
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Container and Row</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Bootstrap Container and Row</ h1 >
< p >The div below has container, and border classes
attached.</ p >
< div class="container">
< h2 >This is the container</ h2 >
< div class="row border">
< h3 >This is the row</ h3 >
< div class="col border">< h4 >This is the first
column.</ h4 ></ div >
< div class="col border">< h4 >This is the second
column</ h4 ></ div >
</ div >
</ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body ></ html >
Example 39
We can divide the row up to twelve times, but you can not use the
class border to add a visual presence. If you do, the columns will not
fit all twelve.
Columns will attempt to fit themselves as best as they can to the width
of your browser viewport. Breakpoints allow layout designers to adjust
columns for a mobile layout by defining at which point a column
switches to 100% viewport width. We’ve seen this with container
snapping too, where xxl will snap 100% width when below 1320px and
small snaps below 540px.
The following image demonstrates reflow, where the first six lines
have received breakpoints xxl, xl, lg, md, and sm.
To add a breakpoint to a column, simply use the class col-* where the
asterisk can be replaced with xxl, xl, lg, md and sm.
When we use the col class, Bootstrap will evenly distribute the space
between the columns. But we often want control over this spacing. To
do this we can use a number range between one and twelve.
Because the maximum number of columns you can have per row is
twelve, you can use that range of numbers.
Example 41
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Column sizing</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Bootstrap Column sizing</ h1 >
< p >The div below has container, and border classes
attached.</ p >
< div class="container">
< h2 >This is the container</ h2 >
< div class="row">
< h3 >2 Columns automatic</ h3 >
< div class="col">< div class="border">< h4
>Column</ h4 ></ div ></ div >
< div class="col">< div class="border">< h4
>Column</ h4 ></ div ></ div >
</ div >
< div class="row">
< h3 >2 Columns equal size</ h3 >
< div class="col-6">< div class="border">< h4
>Column width 6</ h4 ></ div ></ div >
< div class="col-6">< div class="border">< h4
>Column width 6</ h4 ></ div ></ div >
</ div >
< div class="row">
< h3 >2 Columns uneven size</ h3 >
< div class="col-10">< div class="border">< h4
>Column width 10</ h4 ></ div ></ div >
< div class="col-2">< div class="border">< h4
>Column width 2</ h4 ></ div ></ div >
</ div >
< div class="row">
< h3 >3 Columns 6-4-2 sizing</ h3 >
< div class="col-6">< div class="border">< h4
>Column width 6</ h4 ></ div ></ div >
< div class="col-4">< div class="border">< h4
>Column width 4</ h4 ></ div ></ div >
< div class="col-2">< div class="border">< h4
>Column width 2</ h4 ></ div ></ div >
</ div >
< div class="row">
< h3 >3 Columns 2-6-4 sizing</ h3 >
< div class="col-2">< div class="border">< h4
>Column width 2</ h4 ></ div ></ div >
< div class="col-6">< div class="border">< h4
>Column width 6</ h4 ></ div ></ div >
< div class="col-4">< div class="border">< h4
>Column width 4</ h4 ></ div ></ div >
</ div >
< div class="row">
< h3 >7 Columns 1-1-1-1-1-1-6 sizing</ h3 >
< div class="col-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-6">< div class="border">< h4
>Column width 6</ h4 ></ div ></ div >
</ div >
</ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body ></ html >
Rather than having rows of equal spacing, we now have rows with
different spacing configurations.
The first 2 Columns automatic and 2 Columns equal size achieve the
same result using two different methods.
The first uses the col class on it’s own. The columns then
automatically divide the space.
Then we have col-6, which achieves the same result, but we manually
define the size of each of the columns.
Meanwhile, we can adjust the two columns so we have one wide and
one short. We achieve this by setting column widths to ten and two.
Remember that the total must be twelve when doing this or you will
leave a space or go beyond the boundaries of the twelve columns.
You can have as many columns as you like, up to the value of twelve.
However, at twelve there’s no point in assigning values because it will
have to divide equally to work. With eleven columns you can have one
set to two, and the rest set to one. With six columns you can have a
more varied range of sizes as long as they all calculate to twelve when
added together.
Here’s some three column examples that are very common when
developing with Bootstrap.
Example 42
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Column sizing</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Bootstrap Column sizing</ h1 >
< p >The div below has container, and border classes
attached.</ p >
< div class="container">
< h2 >This is the container</ h2 >
< div class="row">
< h3 >2 Columns automatic</ h3 >
< div class="col">< div class="border">< h4
>Column</ h4 ></ div ></ div >
< div class="col">< div class="border">< h4
>Column</ h4 ></ div ></ div >
</ div >
< div class="row">
< h3 >2 Columns equal size</ h3 >
< div class="col-lg-6">< div class="border">< h4
>Column width 6</ h4 ></ div ></ div >
< div class="col-lg-6">< div class="border">< h4
>Column width 6</ h4 ></ div ></ div >
</ div >
< div class="row">
< h3 >2 Columns uneven size</ h3 >
< div class="col-xxl-10">< div class="border">< h4
>Column width 10</ h4 ></ div ></ div >
< div class="col-md-2">< div class="border">< h4
>Column width 2</ h4 ></ div ></ div >
</ div >
< div class="row">
< h3 >3 Columns 6-4-2 sizing</ h3 >
< div class="col-lg-6">< div class="border">< h4
>Column width 6</ h4 ></ div ></ div >
< div class="col-md-4">< div class="border">< h4
>Column width 4</ h4 ></ div ></ div >
< div class="col-md-2">< div class="border">< h4
>Column width 2</ h4 ></ div ></ div >
</ div >
< div class="row">
< h3 >3 Columns 2-6-4 sizing</ h3 >
< div class="col-lg-2">< div class="border">< h4
>Column width 2</ h4 ></ div ></ div >
< div class="col-lg-6">< div class="border">< h4
>Column width 6</ h4 ></ div ></ div >
< div class="col-lg-4">< div class="border">< h4
>Column width 4</ h4 ></ div ></ div >
</ div >
< div class="row">
< h3 >7 Columns 1-1-1-1-1-1-6 sizing</ h3 >
< div class="col-xl-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-xl-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-xl-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-xl-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-xl-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-xl-1">< div class="border">< h4
>Column width 1</ h4 ></ div ></ div >
< div class="col-xl-6">< div class="border">< h4
>Column width 6</ h4 ></ div ></ div >
</ div >
</ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body ></ html >
w-100
w-75
w-50
w-25
img-fluid
img-thumbnail
float-start
float-end
mx-auto
The w series classes set the width of the image. They are percentage
based, so 100 is full width, 75 is three quarters or 75%, 50 is half or
50%, and 25 is one quarter or 25% width. They take their width from
the parent container, so if you place it in a row or column it will take
the percentage of the div element it is placed in.
The img-fluid class works in the same way as w-100—it simply scales
the image to 100% of the container width.
The float-start class takes the image out of the normal flow. It will not
work inside a row or column class, only a container. The float-end
does the same except it aligns the image with the right side of the
screen.
The mx-auto sets automatic margins on the left and right of the image,
allowing you to centre it.
Example 43
Below we have code that shows the images in their various positions,
sizes and styles.
<!doctype html>
< html lang="en">
< head >
< title >Image sizing and alignment</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet">
</ head >
< body class="p-2">
< h1 >Image sizing and alignment</ h1 >
< div class="container-fluid">
< div class="row m-2">
< img src="https://via.placeholder.com/1000x250?
text=Full+Width" class="w-100">
</ div >
< div class="row m-2">
< img src="https://via.placeholder.com/1000x250?
text=Three+Quaters+Width" class="w-75">
</ div >
< div class="row m-2">
< img src="https://via.placeholder.com/1000x250?
text=Half+Width" class="w-50">
</ div >
< div class="row m-2">
< img src="https://via.placeholder.com/1000x250?
text=Quater+Width" class="w-25">
</ div >
< div class="row m-2">
< img src="https://via.placeholder.com/1000x250?
text=Fluid+Image" class="img-fluid">
</ div >
< div class="row m-2">
< img src="https://via.placeholder.com/500x500?
text=Image+thumbnail" class="img-thumbnail w-50">
</ div >
< div class="row m-2">
< img src="https://via.placeholder.com/250x250?
text=Centered+Image" class="w-25 mx-auto">
</ div >
< img src="https://via.placeholder.com/250x250?
text=Float+Start" class="w-25 float-start">
< img src="https://via.placeholder.com/250x250?
text=Float+End" class="w-25 float-end">
</ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js">
</ script >
</ body >
</ html >
Cards
The vast majority of website designs work around cards because they
work well with responsive web design. As you scale the browser
down, the cards “resize” and “reshuffle” their position on the users
screen.
Card Header
Card Body
Card Footer
Finally we have the card footer, which can hold a summary of the
card, details of the author, a call to action button, social media links or
links to a larger full page article if you’re previewing content elsewhere
on the site.
card
card-header
card-img-top
card-body
card-title
card-text
card-footer
btn btn-primary
To help style the card so it looks nice, we add a p-0 to the card-
header, and a p-2 to the card body.
Example 44
<!doctype html>
< html lang="en">
< head >
< title >Basic Cards</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Basic Cards</ h1 >
< p >Find a basic card setup below.</ p >
< div class="container">
< div class="row">
< div class="col-md-6 mb-2">
< div class="card">
< img
src="https://via.placeholder.com/350x150" class="card-img-
top" alt="placeholder image">
< div class="card-body">
< h2 class="card-title">Card title</
h2 >
< p class="card-text">Lorem ipsum
dolor sit amet, consectetur adipiscing elit. Aliquam a semper
urna. Pellentesque at massa metus. Vivamus justo augue,
accumsan sit amet odio ut, sollicitudin rhoncus leo. Fusce
non felis non mi fringilla tincidunt ac in arcu. Fusce elit
justo, hendrerit eget augue a, suscipit luctus urna. Aenean
eu neque pulvinar, pharetra mauris at, facilisis est. Fusce
eu commodo quam, eu rhoncus tellus. Duis nec eros elit.</ p >
< a href="#" class="btn btn-
primary">Go somewhere</ a >
</ div >
< div class="card-footer">
Card footer
</ div >
</ div >
</ div >
< div class="col-md-6 mb-2">
< div class="card">
< img
src="https://via.placeholder.com/350x150" class="card-img-
top" alt="placeholder image">
< div class="card-body">
< h2 class="card-title">Card title</
h2 >
< p class="card-text">Lorem ipsum
dolor sit amet, consectetur adipiscing elit. Aliquam a semper
urna. Pellentesque at massa metus. Vivamus justo augue,
accumsan sit amet odio ut, sollicitudin rhoncus leo. Fusce
non felis non mi fringilla tincidunt ac in arcu. Fusce elit
justo, hendrerit eget augue a, suscipit luctus urna. Aenean
eu neque pulvinar, pharetra mauris at, facilisis est. Fusce
eu commodo quam, eu rhoncus tellus. Duis nec eros elit.</ p >
< a href="#" class="btn btn-
primary">Go somewhere</ a >
</ div >
< div class="card-footer">
Card footer
</ div >
</ div >
</ div >
</ div >
</ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
Gutters
Gutters represent the spacing between your columns. They are used
to space and align content in the Bootstrap grid system. Many
inexperienced users will attempt to use margins and padding to create
the spaces they want between their columns; however, this will mess
up the layout of the cards. To add both horizontal and vertical spacing
we use the gutter classes.
For vertical spacing we use the gy-* class, which also accepts values
up to 5. Again, the higher the value, the wider the spacing between
the top and bottom of rows.
The gx-* and gy-* classes are applied to the element with a row class,
and the gutter sizing is then carried on throughout the column
structure.
Example 45
Look for the row classes and you will see that a gx-* has been applied,
which then carries on throughout the whole row classed element.
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Horizontal Gutter Sizing</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Bootstrap Horizontal Gutter Sizing</ h1 >
< p >The container below, has rows with a horizontal gutter
applied at varied levels.</ p >
< div class="container">
< div class="row gx-1">
< div class="col">
< div class="p-3 border bg-light">Column with
gutter of 1</ div >
</ div >
< div class="col">
< div class="p-3 border bg-light">Column with
gutter of 1</ div >
</ div >
</ div >
< div class="row gx-2">
< div class="col">
< div class="p-3 border bg-light">Column with
gutter of 2</ div >
</ div >
< div class="col">
< div class="p-3 border bg-light">Column with
gutter of 2</ div >
</ div >
</ div >
< div class="row gx-3">
< div class="col">
< div class="p-3 border bg-light">Column with
gutter of 3</ div >
</ div >
< div class="col">
< div class="p-3 border bg-light">Column with
gutter of 3</ div >
</ div >
</ div >
< div class="row gx-4">
< div class="col">
< div class="p-3 border bg-light">Column with
gutter of 4</ div >
</ div >
< div class="col">
< div class="p-3 border bg-light">Column with
gutter of 4</ div >
</ div >
</ div >
< div class="row gx-5">
< div class="col">
< div class="p-3 border bg-light">Column with
gutter of 5</ div >
</ div >
< div class="col">
< div class="p-3 border bg-light">Column with
gutter of 5</ div >
</ div >
</ div >
</ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
Example 46
Next we apply the gy-* class to the div element that has the class rows
assigned. By doing this, the columns are affected automatically within
that div. The gutter spacing will increase with each instance of this
action.
Look for the row and gy-* values to see the comparison.
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Vertical Gutter Sizing</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
crossorigin="anonymous">
</ head >
< body >
< h1 >Bootstrap Vertical Gutter Sizing</ h1 >
< p >The container below has rows with a vertical gutter
applied at varied levels.</ p >
< div class="container">
< div class="row gy-1 border my-3 pb-1">
< div class="col-6">
< div class="p-3 border bg-light">Column 1</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 2</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 3</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 4</
div >
</ div >
</ div >
< div class="row gy-2 border my-3 pb-2">
< div class="col-6">
< div class="p-3 border bg-light">Column 1</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 2</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 3</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 4</
div >
</ div >
</ div >
< div class="row gy-3 border my-3 pb-3">
< div class="col-6">
< div class="p-3 border bg-light">Column 1</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 2</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 3</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 4</
div >
</ div >
</ div >
< div class="row gy-4 border my-3 pb-4">
< div class="col-6">
< div class="p-3 border bg-light">Column 1</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 2</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 3</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 4</
div >
</ div >
</ div >
< div class="row gy-5 border my-3 pb-5">
< div class="col-6">
< div class="p-3 border bg-light">Column 1</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 2</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 3</
div >
</ div >
< div class="col-6">
< div class="p-3 border bg-light">Column 4</
div >
</ div >
</ div >
</ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></ script >
</ body >
</ html >
Example 47
Finally we have the gx-* and gy-* classes combine in ever-increasing
values to create a very interesting and complicated website layout.
If you look at websites like YouTube, Netflix and others you will see a
very similar style of layout.
Take the time to look at the way Amazon is laid out, and how Google
organises photographs. You will see this responsive layout method
used all across the internet.
<!doctype html>
< html lang="en">
< head >
< title >Bootstrap Horizontal Gutter Sizing</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet">
</ head >
< body >
< h1 >Bootstrap Vertical Gutter Sizing</ h1 >
< p >The container below, has rows with a vertical gutter
applied at varied levels.</ p >
< div class="container">
< h2 >Size 1 on x and y gutter</ h2 >
< div class="row gx-1 gy-1">
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
</ div >
</ div >
< div class="container mt-2">
< h2 >Size 3 on x and y gutter</ h2 >
< div class="row gx-3 gy-3">
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
< div class="col">
< div class="p-3 border">Column</ div >
</ div >
</ div >
The goal of the nav bar is to provide a branding image and some
simple navigation elements that all neatly fold up into a large
touchscreen-friendly burger menu.
Always use the nav element when creating the top navigation bar.
Assign it with the classes:
navbar
navbar-expanded
navbar-light
bg-light
Or
navbar
navbar-expanded-lg
navbar-dark
bg-dark
The first will produce a light bright navbar, while the second will
present a dark one.
We can also use breakpoints, and I recommend adding -lg to the end
of expanded.
The navbar class sets up all the formatting required for a navbar.
The navbar-light and navbar-dark classes simply set the text and
background colours.
container-fluid
navbar-brand
navbar-toggler
navbar-toggler-icon
collapse navbar-collapse
navbar-nav me-auto mb-2 mb-lg-0
nav-item
nav-link active
nav-item
nav-link
This structure might look a little scary, but all you really have to do is
copy and paste this block of code at the top of any website.
The collapse navbar-collapse contains all the menu links you want to
appear in your navbar. It is the target Bootstrap uses to swap
between the item menu layout and the burger layout.
The navbar-nav and associated margin classes control how the items
in the navbar are laid out.
Then we have the nav-item, which is where you place your links using
a list structure format. Each navigation link must have nav-item as a
class. The nav-link styles your <a> links into a navigation hyperlink.
The active class indicates which page you are on. If you have a
website with multiple places, and you are on a page other than home,
the active class goes to that link item and gives a visual indication of
where you are on the site.
container-fluid
navbar-brand
navbar-toggler
navbar-toggler-icon
collapse navbar-collapse
nav-item
nav-link active
nav-item
nav-link
Example 48
<!doctype html>
< html lang="en">
< head >
< title >Navigation Bar</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width, initial-
scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet">
</ head >
< body >
< nav class="navbar navbar-expand-lg navbar-light bg-light">
< div class="container-fluid">
< a class="navbar-brand" href="#">< img
src="https://via.placeholder.com/125x60" class="card-img-
top"
alt="placeholder image"></ a >
< button class="navbar-toggler" type="button" data-bs-
toggle="collapse" data-bs-target="#navbarSupportedContent">
< span class="navbar-toggler-icon"></ span >
</ button >
< div class="collapse navbar-collapse"
id="navbarSupportedContent">
< ul class="navbar-nav me-auto mb-2 mb-lg-0">
< li class="nav-item">
< a class="nav-link active" aria-current="page"
href="#">Home</ a >
</ li >
< li class="nav-item">
< a class="nav-link" aria-current="page"
href="#Welcome">Welcome</ a >
</ li >
< li class="nav-item">
< a class="nav-link" aria-current="page"
href="#Container1">Container 1</ a >
</ li >
< li class="nav-item">
< a class="nav-link" aria-current="page"
href="#Container2">Container 2</ a >
</ li >
< li class="nav-item">
< a class="nav-link" aria-current="page"
href="#Container3">Container 3</ a >
</ li >
</ ul >
</ div >
</ div >
</ nav >
< div class="container mt-2" id="Welcome">
< div class="row">
< div class="col-md-12 mb-2">
< div class="card mb-3">
< div class="row g-0">
< div class="col-lg-4 d-none d-lg-block">
< img
src="https://via.placeholder.com/300x450" class="h-100"
alt="null">
</ div >
< div class="col-lg-8">
< div class="card-body">
< h1 class="card-title">Footer</
h1 >
< p class="card-text">This is a
demonstration of a footer in action.</ p >
</ div >
</ div >
</ div >
</ div >
</ div >
</ div >
</ div >
< div class="container" id="Container1">
< h2 >Container 1</ h2 >
< div class="row">
< div class="col-md-6 mb-2">
< div class="card">
< img src="https://via.placeholder.com/350x150"
class="card-img-top" alt="placeholder image">
< div class="card-body">
< h2 class="card-title">Card title</ h2 >
< p class="card-text">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Aliquam a semper urna.
Pellentesque at massa metus. Vivamus justo
augue, accumsan sit amet odio ut, sollicitudin rhoncus leo.
Fusce non felis non mi fringilla tincidunt ac in
arcu. Fusce elit justo, hendrerit eget augue a, suscipit
luctus urna. Aenean eu neque pulvinar, pharetra
mauris at, facilisis est. Fusce eu commodo quam, eu
rhoncus tellus. Duis nec eros elit.</ p >
< a href="#" class="btn btn-primary">Go
somewhere</ a >
</ div >
< div class="card-footer">
Card footer
</ div >
</ div >
</ div >
< div class="col-md-6 mb-2">
< div class="card">
< img src="https://via.placeholder.com/350x150"
class="card-img-top" alt="placeholder image">
< div class="card-body">
< h2 class="card-title">Card title</ h2 >
< p class="card-text">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Aliquam a semper urna.
Pellentesque at massa metus. Vivamus justo
augue, accumsan sit amet odio ut, sollicitudin rhoncus leo.
Fusce non felis non mi fringilla tincidunt ac in
arcu. Fusce elit justo, hendrerit eget augue a, suscipit
luctus urna. Aenean eu neque pulvinar, pharetra
mauris at, facilisis est. Fusce eu commodo quam, eu
rhoncus tellus. Duis nec eros elit.</ p >
< a href="#" class="btn btn-primary">Go
somewhere</ a >
</ div >
< div class="card-footer">
Card footer
</ div >
</ div >
</ div >
</ div >
</ div >
< div class="container" id="Container2">
< h2 >Cotnainer 2</ h2 >
< div class="row">
< div class="col-md-6 mb-2">
< div class="card">
< img src="https://via.placeholder.com/350x150"
class="card-img-top" alt="placeholder image">
< div class="card-body">
< h2 class="card-title">Card title</ h2 >
< p class="card-text">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Aliquam a semper urna.
Pellentesque at massa metus. Vivamus justo
augue, accumsan sit amet odio ut, sollicitudin rhoncus leo.
Fusce non felis non mi fringilla tincidunt ac in
arcu. Fusce elit justo, hendrerit eget augue a, suscipit
luctus urna. Aenean eu neque pulvinar, pharetra
mauris at, facilisis est. Fusce eu commodo quam, eu
rhoncus tellus. Duis nec eros elit.</ p >
< a href="#" class="btn btn-primary">Go
somewhere</ a >
</ div >
< div class="card-footer">
Card footer
</ div >
</ div >
</ div >
< div class="col-md-6 mb-2">
< div class="card">
< img src="https://via.placeholder.com/350x150"
class="card-img-top" alt="placeholder image">
< div class="card-body">
< h2 class="card-title">Card title</ h2 >
< p class="card-text">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Aliquam a semper urna.
Pellentesque at massa metus. Vivamus justo
augue, accumsan sit amet odio ut, sollicitudin rhoncus leo.
Fusce non felis non mi fringilla tincidunt ac in
arcu. Fusce elit justo, hendrerit eget augue a, suscipit
luctus urna. Aenean eu neque pulvinar, pharetra
mauris at, facilisis est. Fusce eu commodo quam, eu
rhoncus tellus. Duis nec eros elit.</ p >
< a href="#" class="btn btn-primary">Go
somewhere</ a >
</ div >
< div class="card-footer">
Card footer
</ div >
</ div >
</ div >
</ div >
</ div >
< div class="container" id="Container3">
< h2 >Cotnainer 3</ h2 >
< div class="row">
< div class="col-md-6 mb-2">
< div class="card">
< img src="https://via.placeholder.com/350x150"
class="card-img-top" alt="placeholder image">
< div class="card-body">
< h2 class="card-title">Card title</ h2 >
< p class="card-text">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Aliquam a semper urna.
Pellentesque at massa metus. Vivamus justo
augue, accumsan sit amet odio ut, sollicitudin rhoncus leo.
Fusce non felis non mi fringilla tincidunt ac in
arcu. Fusce elit justo, hendrerit eget augue a, suscipit
luctus urna. Aenean eu neque pulvinar, pharetra
mauris at, facilisis est. Fusce eu commodo quam, eu
rhoncus tellus. Duis nec eros elit.</ p >
< a href="#" class="btn btn-primary">Go
somewhere</ a >
</ div >
< div class="card-footer">
Card footer
</ div >
</ div >
</ div >
< div class="col-md-6 mb-2">
< div class="card">
< img src="https://via.placeholder.com/350x150"
class="card-img-top" alt="placeholder image">
< div class="card-body">
< h2 class="card-title">Card title</ h2 >
< p class="card-text">Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Aliquam a semper urna.
Pellentesque at massa metus. Vivamus justo
augue, accumsan sit amet odio ut, sollicitudin rhoncus leo.
Fusce non felis non mi fringilla tincidunt ac in
arcu. Fusce elit justo, hendrerit eget augue a, suscipit
luctus urna. Aenean eu neque pulvinar, pharetra
mauris at, facilisis est. Fusce eu commodo quam, eu
rhoncus tellus. Duis nec eros elit.</ p >
< a href="#" class="btn btn-primary">Go
somewhere</ a >
</ div >
< div class="card-footer">
Card footer
</ div >
</ div >
</ div >
</ div >
</ div >
< script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js">
</ script >
</ body >
</ html >
Footer
You can copy and paste it to the end of any document, then make
only minimal changes.
Example 49
<!doctype html>
< html lang="en">
< head >
< title >Footer</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width,
initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet"
>
</ head >
< body >
< nav class="navbar navbar-expand-lg navbar-light bg-
light">
< div class="container-fluid">
< a class="navbar-brand" href="#">< img
src="https://via.placeholder.com/125x60" class="card-img-
top"
alt="placeholder image"></ a >
< button class="navbar-toggler" type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-
controls="navbarSupportedContent" aria-expanded="false"
aria-label="Toggle navigation">
< span class="navbar-toggler-icon"></ span >
</ button >
< div class="collapse navbar-collapse"
id="navbarSupportedContent">
< ul class="navbar-nav me-auto mb-2 mb-lg-0">
< li class="nav-item">
< a class="nav-link active" aria-
current="page" href="#">Home</ a >
</ li >
< li class="nav-item dropdown">
< a class="nav-link dropdown-toggle"
href="#" id="navbarDropdown" role="button"
data-bs-toggle="dropdown" aria-
expanded="false">
Dropdown menu
</ a >
< ul class="dropdown-menu" aria-
labelledby="navbarDropdown">
< li >< a class="dropdown-item"
href="#Welcome">Welcome</ a ></ li >
< li >< a class="dropdown-item"
href="#Container1">Container 1</ a ></ li >
</ ul >
</ li >
</ ul >
</ div >
</ div >
</ nav >
< div class="container mt-2" id="Welcome">
< div class="row">
< div class="col-md-12 mb-2">
< div class="card mb-3">
< div class="row g-0">
< div class="col-md-4">
< img
src="https://via.placeholder.com/300x450" class="h-100"
alt="null">
</ div >
< div class="col-md-8">
< div class="card-body">
< h1 class="card-
title">Footer</ h1 >
< p class="card-text">This is
a demonstration of a footer in action.</ p >
</ div >
</ div >
</ div >
</ div >
</ div >
</ div >
</ div >
< div class="container" id="Container1">
< h2 >Container 1</ h2 >
< div class="row">
< div class="col-md-6 mb-2">
< div class="card">
< img
src="https://via.placeholder.com/350x150" class="card-img-
top" alt="placeholder image">
< div class="card-body">
< h2 class="card-title">Card title</
h2 >
< p class="card-text">Lorem ipsum
dolor sit amet, consectetur adipiscing elit. Aliquam a semper
urna.
Pellentesque at massa metus.
Vivamus justo augue, accumsan sit amet odio ut, sollicitudin
rhoncus leo.
Fusce non felis non mi fringilla
tincidunt ac in arcu. Fusce elit justo, hendrerit eget
augue a, suscipit
luctus urna. Aenean eu neque
pulvinar, pharetra mauris at, facilisis est. Fusce eu commodo
quam, eu
rhoncus tellus. Duis nec eros
elit.</ p >
< a href="#" class="btn btn-
primary">Go somewhere</ a >
</ div >
< div class="card-footer">
Card footer
</ div >
</ div >
</ div >
< div class="col-md-6 mb-2">
< div class="card">
< img
src="https://via.placeholder.com/350x150" class="card-img-
top" alt="placeholder image">
< div class="card-body">
< h2 class="card-title">Card title</
h2 >
< p class="card-text">Lorem ipsum
dolor sit amet, consectetur adipiscing elit. Aliquam a semper
urna.
Pellentesque at massa metus.
Vivamus justo augue, accumsan sit amet odio ut, sollicitudin
rhoncus leo.
Fusce non felis non mi fringilla
tincidunt ac in arcu. Fusce elit justo, hendrerit eget
augue a, suscipit
luctus urna. Aenean eu neque
pulvinar, pharetra mauris at, facilisis est. Fusce eu commodo
quam, eu
rhoncus tellus. Duis nec eros
elit.</ p >
< a href="#" class="btn btn-
primary">Go somewhere</ a >
</ div >
< div class="card-footer">
Card footer
</ div >
</ div >
</ div >
</ div >
</ div >
< footer class="bg-dark text-light text-center text-lg-
start">
< div class="container p-4">
< div class="row">
< div class="col-md-9 mb-4">
< h5 class="text-uppercase">Footer
Content</ h5 >
< p > Lorem ipsum dolor sit amet
consectetur, adipisicing elit. Iste atque ea quis molestias.
Fugiat pariatur maxime quis culpa corporis vitae repudiandae
aliquam voluptatem veniam, est atque cumque eum delectus
sint! </ p >
</ div >
< div class="col-md-3 mb-4">
< h2 class="text-uppercase mb-0">Links</
h5 >
< ul class="list-unstyled">
< li >< a href="#Welcome" class="text-
light">Welcome</ a ></ li >
< li >< a href="#Container1"
class="text-light">Container 1</ a ></ li >
</ ul >
</ div >
</ div >
</ div >
< div class="text-center p-3">Copyright © 2021 < a
class="text-primary text-decoration-none"
href="https://www.ctelearning.com">CT< sup >e</ sup >
Learning</ a >
</ div >
</ footer >
Sit down and imagine what direction you want to take your new skills
in. Are you going to design a website for yourself, or are you going to
jump into Fiverr and start promoting your skills for jobs.
No matter what you do, the next step has to be “making a portfolio”. A
portfolio is a tool you can fall back on when attempting to get work, or
demonstrating to clients why they want to hire you.
It will help get you work, jobs and develop your skills further.
It will also help you identify where you are lacking in your skills or
understanding.
The next step in your career
You now know the technical knowledge you need to produce good
quality bootstrap websites. The next step should be to practice your
new skills. I would strongly recommend producing your own portfolio if
you seek work, online jobs, and others. Books are a great starting
point, but it can never replace hands on experience.