Exercise 5_Getting Started With Bootstrap
Exercise 5_Getting Started With Bootstrap
This exercise introduces the first set of steps to set up your web page to make use of
Bootstrap classes and components. By the end of this exercise, you will be able to:
Downloading Bootstrap
You will use npm to fetch the Bootstrap files for use within your project. Thereafter you
need to install JQuery and Popper.js as shown below since Bootstrap 5 depends on these
two. At the prompt, type the following to fetch Bootstrap files to your project folder:
Open the index.html file in your favourite text editor. If you are using Visual Studio
Code, Brackets, Sublime Text or similar editors, you can open the project folder in the
editor and then view index.html.
Insert the following code in the <head> of index.html file before the title.
<meta charset="utf-8">
Page 1
<meta name="viewport" content="width=device-width,
initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet"
href="node_modules/bootstrap/dist/css/bootstrap.min.css
">
This will include Bootstrap CSS into your web page. Note the subtle change in the fonts
of the content of the web page. This is the Bootstrap typography effect coming into play.
The default Bootstrap typography sets the font to Helvetica Neue and selects the
appropriate font size based on the choice of the heading style and paragraph style for the
content.
At the bottom of the page, just before the end of the body tag, add the following code to
include the JQuery library, popper.js library and Bootstrap's Javascript plugins. Bootstrap
by default uses the JQuery Javascript library for its Javascript plugins. Hence the need to
include JQuery library in the web page.
<script
src="node_modules/jquery/dist/jquery.slim.min.js"></scr
ipt>
Now, do a Git commit with the message "Intro. to Bootstrap". You may push the commit
to your online repository.
Exercises
Page 2
1. Create website with bootstrap 5 as image below
Page 3
3. Create website with bootstrap 5 as image below
Page 4
5. Create website with bootstrap 5 as image below
Page 5
Conclusion
Page 6
After learning Bootstrap 5, you should have gained a solid understanding of the framework
and its various components and features.
Page 7