Bootstrap 5 Foundations
Bootstrap 5 Foundations
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.
Luckily for you, Bootstrap means you don’t have to be an expert in CSS to make
great-looking websites. You only need a very basic CSS knowledge and a good
HTML5 knowledge.
Learning HTML5 is certainly not a step you should skip— the elements’ names
have real purpose with wide-ranging effects that go beyond how a website
simply looks, and into SEO, accessibility and machine understanding of your
site.
As long as you have a good solid understanding of HTML5, and a little CSS
knowledge, you will be able to achieve a great-looking website with this book.
The Author
Hello, I’ve been an technical education writer for nearly a decade, having
produced many courses, videos, and more recently literature and podcasts.
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
Finally I write technical industry standard courses which are taught worldwide in
schools, colleges and universities. You can find these sold through my business
partner's website.
www.ctelearning.com
https://webprofessionalsglobal.org/
These projects, associations and business connects are the result of many years
working for the industry and I’m excited to expand my product into the eBook
domain.
Table of Content
1. Bootstrap Foundations eBook
2. The Random Knowledge Enthusiast
3. Bootstrap 5 Foundations
4. https://www.therke.com/
5. In partnership with CTe Learning
6. Dedication
7. Preface
8. The Author
9. Table of Content
10. About the book
1. Why be a front-end web developer?
1. The money
2. The fame
3. The Power
2. What do I need?
3. Why Bootstrap 5?
4. Requirements
5. What is Bootstrap?
6. Bootstrap versions
7. Teaching bleeding edge technology
8. What’s new in Bootstrap 5?
11. Getting Started with Bootstrap 5
1. Example 1
2. Example 2
3. Example 3
4. Example 4
12. Bootstrap is a CSS class system
13. Typography
1. Headings Typography
1. Example 5
2. Example 6
3. Example 7
2. Heading classes
1. Example 8
3. A note about SEO
4. Secondary heading text
1. Example 9
2. Example 10
5. Display Headings
1. Example 11
2. Example 12
6. Creating Lead Text
1. Example 13
2. Example 14
7. Text Alignment
1. Example 15
8. Font Sizing
1. Example 16
2. Example 17
9. Text Styles and weight
1. Example 18
10. Text Line-height
1. Example 19
11. Text Transform
1. Example 20
12. Underline strikethrough and removal of underline.
1. Example 21
13. Lists
1. Example 22
14. Bootstrap Colours
1. Example 23
15. Borders
1. Example 24
2. Example 25
16. Margins
1. Example 26
2. Example 27
17. Padding
1. Example 28
2. Example 29
18. Bootstrap Buttons
1. Example 30
2. Example 31
19. Bootstrap Buttons with outlines
1. Example 32
2. Example 33
20. End of section activity
14. Responsive Layout
1. Bootstrap Containers
1. Example 34
2. Bootstrap containers with breakpoints
1. Example 35
3. Fluid Container
1. Example 36
4. Bootstrap Grid System
1. Example 37
2. Example 38
3. Example 39
5. Column breakpoints
1. Example 40
6. Column Sizing
1. Example 41
7. Column sizing and breakpoints
1. Example 42
8. Images
1. Example 43
9. Cards
1. Example 44
10. Gutters
1. Example 45
2. Example 46
3. Example 47
11. Nav
1. Example 48
12. Footer
1. Example 49
13. End of section activity
15. The next step in your career
About the book
This is not just any old eBook, it is a career building tool that will open
doorways for you.
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
Too many managers, entrepreneurs and business owners depend on the internet
to spread the word about their products and services but have almost zero
knowledge of it. As you rise through the ranks of your company, or build a
company of your own, you can approach tasks with a developer’s mindset. You
will be able to communicate on an equal footing with your development team as
well as understand how they get things done and what they need to make your
business succeed. Never underestimate a manager with a technical background.
They make projects succeed.
What do I need?
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?
Bootstrap has received over six hundred contributors to its codebase, and has
over 34,000 forks on GitHub.
Bootstrap 5 has moved away from jQuery, which it was previously heavily
reliant on. Instead Bootstrap relies on JavaScript alone, making it easier to learn
than ever before.
Whether you plan to make templates for a living, or become a full stack
developer, understanding Bootstrap will go a long way in your career.
Requirements
HTML5
HTML Elements
HTML Attributes
Event handlers
CSS3
Class selectors
ID selectors #
Wildcard selectors *
What JavaScript is
Bootstrap uses HTML5 as the means to create content, and Bootstrap adds a
large number of CSS classes that can be assigned to those elements. In addition
to this, JavaScript code has been provided to deliver specific functionality.
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.
Because it is important to prepare students for the very latest technology and to
give this course and its knowledge the longest possible use, we will be teaching
5.0 Beta 2 of Bootstrap so that you are fully prepared to use it when entering the
job market. Employers more often than not require the most up-to-date skills.
What we are describing is a process called future proofing, which means
learning a technology before or soon after it has been released to allow you to
react faster to an ever-evolving market.
What’s new in Bootstrap 5?
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.
Bootstrap 5 broke away from jQuery and stopped supporting Internet Explorer
10 and 11, which has been replaced with Microsoft Edge. It is designed with the
latest version of web browsers.
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 >
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/[email protected]
beta3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
</ head >
Example 3
<!doctype html>
< html lang="en">
< head >
< title >Minimal Bootstrap 5 page</ title >
< link href="https://cdn.jsdelivr.net/npm/[email protected]
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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></ script >
</ body >
</ html >
Now that we have this template, we are ready to begin using Bootstrap.
Bootstrap is a CSS class system
Bootstrap works by taking standard HTML elements and assigning pre-written
CSS classes to them. To use Bootstrap, you need to know the class names. The
basic class names, in alphabetical order are:
active
alert
align
badge
bg
blockquote
border
btn
card
carousel
clearfix
close
Col
container
custom
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
You don’t have to remember all of these right now—classes will be explored
individually as we use them.
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>
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.
To make your site accessible to as many users as possible, you need to ensure
that heading structures are used in the correct way, which means you can use as
many <h2> headings after the first <h1> but you may not jump to <h4> just
because you like the style and look. The way headings look serve a purpose. The
user needs to understand which heading belongs to which group.
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.
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body >
</ html >
Heading classes
In addition to the default <h1> to <h6> elements being styled, we have access to
the same styles with the same names using class selectors rather than element
selectors. This allows the developer to fake headings if they need to. In some
applications this can be required, especially when generating custom elements.
Example 8
We created a document that uses both the H elements, and a paragraph with the
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/[email protected]
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/[email protected]
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.
SEO relies on trust. It is a common trick for less than honest developers to write
a website claiming to be one thing, and then provide different content.
Say for example, a popular show is trending like The Mandalorian . You could
easily write a website with the title “Top 10 Mandalorian scenes that will amaze
you!” If a search engine finds it and says “That’s popular, let's push this page up
the search rankings,” you can quickly gain a lot of traffic.
Today however, some basic checks on trust are performed. One of these is that
the website title must match the first <h1> found in the document.
If your website title is “Top 10 Mandalorian scenes that will amaze you!” and
your <h1> says “Get out of debt with these 10 credit cards,” then the search
engine will not trust the site. To help ensure trust, the <h1> must repeat what the
website title states. If they don’t match, your site is treated as suspicious and
pushed down the search rankings.
Ensure that you use the <h1> element just once on your website, and ensure that
it has the same text as your title element.
Secondary heading text
Sometimes you will want to create secondary text in your headings to provide
extra information. To do this we have the .text-muted class. It is best placed in
<small> elements which will reduce the size of the font in addition to changing
the colour of the text.
< h2 >Top Tech Tips < small class="text-muted">for an amazing tech career</ small
></ h2 >
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.
This is best used on secondary and lower headings <h2> to <h6> so we don’t
risk affecting the SEO of the <h1> element, which should reflect the <title>
element’s textual content.
<!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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></ script >
</ body >
</ html >
Example 10
<!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/[email protected]
beta3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
</ head >
< body >
< h1 >Hotel Rooms</ h1 >
< h2 >Bay view room < small class="text-muted">£500 + vat</ small ></ h2 >
< p >Our amazing bay view room, gives views of the ships coming in and our of the
harbour all year long.</ p >
< script src="https://cdn.jsdelivr.net/npm/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></ script >
</ body >
</ html >
Display Headings
Display headings are a means of grabbing the user’s attention with a big display.
While the standard <h1> to <h6> levels should be maintained when organising a
document, if you are providing a heading that needs a heavier presentation on
the page then the .display-1 to .display-6 classes aid with this.
If you are promoting a message, a call to action, or other major feature on your
site, display headings are very useful.
However, display headings do not change the nature of the element or the
perceived importance of the heading level. Remember that heading levels have a
strict hierarchy, you should never jump heading levels, and should always keep
them organised. A single <h1> per page, matching the <title> followed by your
headings and subheadings being present in levels 2 through to 6.
In addition to this, you should also ensure that people visually understand what
level heading you are using. Don’t make a level heading 6 match the style of a
display-1, because you are not relaying the importance level of that heading.
Example 11
I would also recommend maintaining a single style. If your page is filled with
display headings and normal headings, then their importance is not maintained.
Their structure becomes visually messy.
<!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/[email protected]
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.
If a <h4> was to be used it should not use a display-4 after no display-3 was
used, because the heading structure will visually lose its meaning.
Creating Lead Text
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/[email protected]
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/[email protected]
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/[email protected]
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
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
In this example we are aligning text using the text-center, text-start and text-end
classes. This paragraph will align to the center.
< 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 >
This paragraph will be aligned to the left like normal, so unless you have
previously used a text alignment this will not change anything.
< 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 >
When we combine it, we simply add it as a normal paragraph, as you can see in
the example below.
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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></ script >
</ body >
</ html >
Example 17
Example 17
In addition to the sizing, we also added a colour factor to enhance the second
part of the warning.
<!doctype html>
< html lang="en">
< head >
< title >Sizing and importance</ title >
< meta charset="utf-8">
< meta name="viewport" content="width=device-width, initial-scale=1">
< link href="https://cdn.jsdelivr.net/npm/[email protected]
beta3/dist/css/bootstrap.min.css" rel="stylesheet" >
</ head >
< body class="p-2">
< h1 >Sizing and importance</ h1 >
< p >Have fun in our pool, but ensure you < strong class="fs-5">never run beside
the pool</ strong > this action < strong class="fs-4 text-danger">may result in death!
</ strong ></ p >
< script src="https://cdn.jsdelivr.net/npm/[email protected]
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body >
</ html >
Text Styles and weight
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
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/[email protected]
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/[email protected]
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 is also known as line spacing. It is a term used to describe the
vertical distance between two lines in a paragraph. Line spacing is an important
aspect to consider when designing your website. It can make a vast difference to
the understanding and readability of your content.
Conventional wisdom is that a line spacing of around 1.3 times the height of text
to 1.5 times the height of text is ideal. There’s enough space for most users to be
able to clearly distinguish between two lines of text.
Line-height-sm provides just 1.25 times the height of the text; we don’t
recommend using this.
Line-height-base is default for Bootstrap and gives a height of 1.5 times the
height of text.
Meanwhile, if you need extra spacing you can use line-height-lg which provides
2 times the height of the text.
In most situations a 2 times line height is excessive, remaining with base, which
is the default and recommended in most situations.
Example 19
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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></ script >
</ body >
</ html >
Underline strikethrough and removal of underline.
We can decorate text using an underline , a line straight through text or remove
the underline from a hyperlink to make it look like normal text.
Some use underline instead of em when emphasizing text; however, this isn’t a
great idea because many users will confuse the text for a hyperlink.
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.
Example 21
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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" ></ script >
</ body >
</ html >
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/[email protected]
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/[email protected]
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.
We should never indicate information using colour alone, because there are
colourblind users out there who can not perceive parts of the spectrum.
However, we typically use these colours for everyone else to convey a meaning.
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.
A warning colour indicates that something has happened that might cause a
problem. Maybe a mail didn’t go through properly, or a warning message that a
piece of data has not been entered into a form correctly.
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.
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.
Colours can be applied using the bg-* and text-* border-* class groups. You can
use any of the named colours as either a background or foreground colour.
Example 23
The example below produces the graphic we see above. We assign the colours to
the bg-* class so the name indicated is the name of the background, not the
foreground colour.
<!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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></ script >
</ body ></ html >
Borders
Every block element can have a border applied. The border is an outline of a
Every block element can have a border applied. The border is an outline of a
block element. It is set all around using the class border.
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.
Additionally we can apply colours to the border by adding the colour names:
border-primary
border-secondary
border-success
border-warning
border-danger
border-dark
border-light
border-info
Example 24
The example below produces the image we see above. We use a combination of
border, border-start, border-end and border-bottom classes. We combine it with
the colours classes border-primary, border-secondary, border-success, etc.
<!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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js"></ script >
</ body ></ html >
Example 25
In addition to creating border and assigning colours we can assign five levels of
thickness with:
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/[email protected]
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 >
< div class="border border-2 m-2">Border with thickness 2</ div >
< div class="border border-3 m-2">Border with thickness 3</ div >
< div class="border border-4 m-2">Border with thickness 4</ div >
< div class="border border-5 m-2">Border with thickness 5</ div >
< script src="https://cdn.jsdelivr.net/npm/[email protected]
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/[email protected]
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/[email protected]
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-*
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.
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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" integrity="sha384-
JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
crossorigin="anonymous"></ script >
</ body ></ html >
Example 29
You can control the direction of the padding, assigning it to top, bottom, start
and end as you do with margins.
m-*
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.
Bootstrap Buttons
Buttons are a very common UI element of Bootstrap, and their style can be used
on hyperlinks, forms, dialog boxes and more.
Buttons can be created from multiple elements, including <a> <input> and
<button>. Even <div> could be used, though it should only be used where the
user is required to interact with that part of the website. Buttons handle colour
changes when the mouse moves over them, and are visually set up so that the
user knows that the text indicates an action will be taken—for example, the
accepting of terms and conditions, the submission of an e-mail or a call to action
where a user should click on a link.
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/[email protected]
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/[email protected]
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.
Bootstrap Buttons with outlines
Buttons are a very common UI element of Bootstrap, and their style can be used
on hyperlinks, forms, dialog boxes and more. In addition to normal buttons, you
can create buttons with an outline style instead of a solid fill. There’s no
particular advantage to create outline buttons beyond styling.
Outline buttons can be created from multiple elements, including <a> <input>
and <button>. Even <div> could be used, though it should only be used where
the user is required to interact with that part of the website. Outline buttons
handle colour changes when the mouse moves over them, and are visually set up
so that the user knows that the text indicates an action will be taken—for
example, the accepting of terms and conditions, the submission of an e-mail or a
call to action where a user should click on a link.
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/[email protected]
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/[email protected]
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.
End of section activity
You’ve learned everything you need to create a fully featured web document,
with heading styling, typography, colours, buttons and more.
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.
The container class uses max-width breakpoints, a CSS rule that triggers upon a
specific width.
Example 34
The effect this class has is to centre content on standard desktop browser views
with a width over 540px.
The animation above shows a Browser Window being resized. The container
snaps to the following pixel widths.
540px
720px
960px
1140px
1320px
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/[email protected]
beta3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
</ head >
< body >
< h1 >Bootstrap Container</ h1 >
< p >The div below has container, and border classes attached.</ p >
< div class="container border">100% wide until small breakpoint</ div >
< script src="https://cdn.jsdelivr.net/npm/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></ script >
</ body ></ html >
Bootstrap containers with breakpoints
container-sm
container-md
container-lg
container-xl
container-xxl
Sm stands for small, md stands for medium, lg stands for large, xl stands for
extra large, and xxl stands for extra extra large.
The classes work in the same way as the normal container; however, the way
they snap to resolutions is different.
Small is the same as just using a container, and it snaps between 540px to
1320px.
The visualisation above demonstrates that the different breakpoints trigger based
on the assigned values sm, md, lg, xl, and xxl. The xxl value snaps to a 100%
width the soonest, whereas the sm value has the most sizes before it simply
snaps to 100% width.
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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></ script >
</ body ></ html >
Fluid Container
The standard container snaps to pre-set pixel widths based on the size of the
browser viewport.
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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></ script >
</ body ></ html >
Bootstrap Grid System
The Bootstrap framework uses a grid system to create content layouts. A grid
system uses rows and columns just as a table would.
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/[email protected]
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">
< span >This is the container. It controls the width of the elements inside.</ span
>
< div class="row border">This is a row, this is a layout tool for stacking elements
within a container.</ div >
</ div >
< script src="https://cdn.jsdelivr.net/npm/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></ script >
</ 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/[email protected]
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/[email protected]
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.
Below is a visual demonstration of how each column reflows to fit your mobile
device. As the screen becomes too narrow, the elements flow evenly onto new
lines. Allowing your website to adjust accordingly. We have added a little colour
so you can track the movement of the columns visually. Columns rearranging in
this way is known as content reflowing.
Column breakpoints
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.
This image demonstrates a normal reflow where no breakpoints have been set.
The following image demonstrates reflow, where the first six lines have received
breakpoints xxl, xl, lg, md, and sm.
As the columns resize, the first to break to 100% is xxl, followed in order by xl,
lg, md, and sm. The rest of the columns never leapt to 100%, but instead tried to
divide the space between them evenly.
Example 40
Example 40
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.
To assign a width to a column, we use col-* where the asterisk can be replaced
with any value between one and twelve.
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/[email protected]
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/[email protected]
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.
< 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 >
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.
with Bootstrap.
They use a 6-4-2, 2-6-4, and there is a 7 column configuration set to 1-1- 1-1-1-
1-6.
It is best to use column sizing and breakpoints together. If you use columns or
column sizing on their own, the columns will divide the browser viewport width
up evenly. The problem with this is that you can end up with some very messy
mobile views.
You will notice that at minimum width the content flows outside boxes, overlaps
and generally creates an ugly mobile website.
If we add breakpoints to the setup, we end up with a much more pleasant layout.
When the breakpoints are reached they automatically reflow to the full width of
the display, creating a stacked mobile layout.
We use the col-sm-*, col-md-*, col-lg-*, col-xl-*, col-xxl-* classes to set the
breakpoints and then set the width by replacing the asterisk with a value between
one and twelve.
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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></ script >
</ body ></ html >
Images
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 img-thumbnail class provides a border around the image indicating that it is
a thumbnail of a larger image. This is often combined with modals, which pop-
up when the image is clicked and show the full image.
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
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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js">
</ script >
</ body >
</ html >
Cards
Cards are a UI (User Interface) item and are somewhat inspired by their real-life
counterparts. A card is a UI container that holds a few pieces of related
information. They roughly represent the playing card in shape and size. They are
presentation units.
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
The header of the card is made up of an image or a title. The example we’re
going to use is one with an image that is the most visually striking. If you use an
image header you can move the heading into the card body, and write it as a
single article of text.
Then we have the card body, which contains the single article of text.
Then we have the card body, which contains the single article of text.
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
< div class="card">
< div class="card-header p-0">
< img src="https://via.placeholder.com/350x150" class="card-img-top"
alt="placeholder image">
</ div >
< div class="card-body p-2">
< 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 >
</ div >
< div class="card-footer">
< a href="#" class="btn btn-primary">Call to action</ a >
</ div >
</ div >
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
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.
Horizontal spacing is achieved using the gx-* class, which accepts values up to
5. The higher the value, the wider the spacing between columns.
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
As you can see, in this simple two column design we have ever-increasing
spacing between the columns, which is carried on for all the columns.
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.
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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 >
Nav
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
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-expanded class allows the navbar to grow and shrink based on the
window width. It allows that burger bar drop-down feature. The lg is a standard
breakpoint, indicating when it should snap into mobile mode.
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
nav-item
nav-item
nav-link
These are used by the BootstrapJavaScript libraries and basically enable the
interactive functionality. The data-bs stands for data Bootstrap, and as the name
suggests it simply toggles states and provides targets for the code to interact with
suggests it simply toggles states and provides targets for the code to interact with
the elements.
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 container-fluid can be swapped out for container and the branding, links and
The container-fluid can be swapped out for container and the branding, links and
content will be centralised like a normal container.
The navbar-brand is where your brand image is placed. I recommend a small low
resolution image of around 125x60 or it will take up too much space.
A button is created with the navbar-toggler, which is a control that appears when
the screen is thin enough and provides a styled button that drops the touch-
friendly menu down.
The span inside narbar-toggler references the icon used. We use the default, but
instead you could place an image or another icon class in here if you don't like
the burger menu and prefer something like three dots.
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-item
nav-link active
nav-ite m
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/[email protected]
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/[email protected]
beta3/dist/js/bootstrap.bundle.min.js">
</ script >
</ body >
</ html >
Footer
The footer serves as the place to store your copyright information, navigation
links and some parting words for those who have reached the end of the page.
A single container is used, along with a row and a couple of columns. These
make up the content and hyperlinks.
You can copy and paste it to the end of any document, then make only minimal
changes.
Example 49
End of section activity
You’ve learned everything you need to create a fully featured website with
navigation, content and a footer. You should practice your skills and make a
multipage website. Look at other sites on the web, and see if you can recreate
them using bootstrap. Look at mobile sites and see how they work and how well
bootstrap compares.
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.
This book was written with the support of https://www.ctelearning.com for all
your career and technical education needs.
1. Bootstrap Foundations eBook
2. The Random Knowledge Enthusiast
3. Bootstrap 5 Foundations
4. https://www.therke.com/
5. In partnership with CTe Learning
6. Dedication
7. Preface
8. The Author
9. Table of Content
10. About the book
1. Why be a front-end web developer?
1. The money
2. The fame
3. The Power
2. What do I need?
3. Why Bootstrap 5?
4. Requirements
5. What is Bootstrap?
6. Bootstrap versions
7. Teaching bleeding edge technology
8. What’s new in Bootstrap 5?
11. Getting Started with Bootstrap 5
1. Example 1
2. Example 2
3. Example 3
4. Example 4
12. Bootstrap is a CSS class system
13. Typography
1. Headings Typography
1. Example 5
2. Example 6
3. Example 7
2. Heading classes
1. Example 8
3. A note about SEO
4. Secondary heading text
1. Example 9
2. Example 10
5. Display Headings
1. Example 11
2. Example 12
6. Creating Lead Text
1. Example 13
2. Example 14
7. Text Alignment
1. Example 15
8. Font Sizing
1. Example 16
2. Example 17
9. Text Styles and weight
1. Example 18
10. Text Line-height
1. Example 19
11. Text Transform
1. Example 20
12. Underline strikethrough and removal of underline.
1. Example 21
13. Lists
1. Example 22
14. Bootstrap Colours
1. Example 23
15. Borders
1. Example 24
2. Example 25
16. Margins
1. Example 26
2. Example 27
17. Padding
1. Example 28
2. Example 29
18. Bootstrap Buttons
1. Example 30
2. Example 31
19. Bootstrap Buttons with outlines
1. Example 32
2. Example 33
20. End of section activity
14. Responsive Layout
1. Bootstrap Containers
1. Example 34
2. Bootstrap containers with breakpoints
1. Example 35
3. Fluid Container
1. Example 36
4. Bootstrap Grid System
1. Example 37
2. Example 38
3. Example 39
5. Column breakpoints
1. Example 40
6. Column Sizing
1. Example 41
7. Column sizing and breakpoints
1. Example 42
8. Images
1. Example 43
9. Cards
1. Example 44
10. Gutters
1. Example 45
2. Example 46
3. Example 47
11. Nav
1. Example 48
12. Footer
1. Example 49
13. End of section activity
15. The next step in your career