Bootstrapcodeacademy
Bootstrapcodeacademy
doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>News Website</title>
</head>
<body>
<div class="container">
<header class="sticky-top">
</div>
</div>
</div>
<span class="navbar-toggler-icon"></span>
</button>
</div>
</div>
</nav>
</header>
<div class="row">
<div class="col-12">
<p class="lead text-light my-3">Teachers say it starts at home! You should begin reading to
</div>
</div>
</div>
</div>
<h3 class="mb-0">
</h3>
adopted sustainable living practices. This change has slowed down the effects of
</div>
</div>
</div>
<h3 class="mb-0">
</h3>
<p class="card-text">American voters under 30 years old came out in droves for
the last election. This trend is inspiring the youths of other democratic nations.</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<h4>About</h4>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<h4 class="font-italic">Archives</h4>
<ol class="list-unstyled">
</ol>
</div>
<div class="col-6">
<h4 class="font-italic">Social</h4>
<ol class="list-unstyled">
<li><a href="#">YouTube</a></li>
<li><a href="#">Twitter</a></li>
<li><a href="#">Facebook</a></li>
</ol>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
LEARN BOOTSTRAP 4: GRID
Getting Started with Bootstrap
Creating a website from scratch can take a lot of work and require a working
knowledge of HTML, CSS, and maybe some JavaScript. But with Bootstrap, the
amount of work and prior knowledge is reduced.
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,
initial-scale=1, shrink-to-fit=no">
1.
Look over the structure of the HTML document in the code editor and take
notice of the <meta> tags in the header and the <script> elements at the
bottom of the <body>. We’ve also included elements that use Bootstrap’s
styling and layout, but we haven’t added in the link to Bootstrap’s CDN.
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bo
otstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iu
XoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
Once you finish, notice how Bootstrap transforms the webpage! Go ahead
resize the browser bigger and smaller to see how Bootstrap displays content
on different sized screens!
Checkpoint 2 Passed
Hint
Make sure that you’ve copied and pasted the line provided inside
the <head> element. Look at the example provided in the narrative or check out
the Bootstrap documentation.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>News Website</title>
</head>
<body>
<div class="container">
<header class="sticky-top">
</div>
</div>
</div>
</div>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
</div>
</div>
</nav>
</header>
<div class="row">
<div class="col-12">
<p class="lead text-light my-3">Teachers say it starts at home! You should begin reading to
</div>
</div>
</div>
<h3 class="mb-0">
</h3>
adopted sustainable living practices. This change has slowed down the effects of
</div>
</div>
</div>
<h3 class="mb-0">
</h3>
<p class="card-text">American voters under 30 years old came out in droves for
the last election. This trend is inspiring the youths of other democratic nations.</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<h4>About</h4>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<h4 class="font-italic">Archives</h4>
<ol class="list-unstyled">
</ol>
</div>
<div class="col-6">
<h4 class="font-italic">Social</h4>
<ol class="list-unstyled">
<li><a href="#">YouTube</a></li>
<li><a href="#">Twitter</a></li>
<li><a href="#">Facebook</a></li>
</ol>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
<div class="container">
<div class="row">
<div class="col">
<!-- A column inside a row inside a container! -->
</div>
</div>
</div>
We can gain even more control of our layout once we start nesting rows inside
columns and setting widths for our columns! But, first, let’s review how to
create a layout using Bootstrap.
Instructions
Take a look at the provided diagram and key — container, rows, columns are
color coded.
https://getbootstrap.com/docs/4.1/layout/grid/
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
</head>
<body>
<div>
<h1>Container Example</h1>
</div>
<br>
<div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
Bootstrap uses classes to apply CSS rulesets — these rulesets dictate the
layout and styling of the element. To create a container, necessary for
Bootstrap’s grid, we assign a class of "container" to a <div> like so:
<div class="container"></div>
The <div> from the example above becomes a Bootstrap container which has a
width relative to a user’s screen size, becomes horizontally centered, and has a
left and right margin.
If we wanted the container to take up the entire width of the screen we can
assign a class of "container-fluid":
<div class="container-fluid"></div>
Knowing how to use documentation is important. We can always check what
classes to add using Bootstrap’s grid documentation.
Note: the Bootstrap site uses CSS notation for classes, which entails having
a . before a class name like .example-class-name.
Instructions
1.
Note that we’ve added some styling in a local CSS file, style.css to add a
background color, a border, and a font color to the <div>s without adding
more Bootstrap classes. This will be a common theme in the following
exercises. We’ve given containers a solid black border and a teal/green
background color.
You will have to resize the browser to see a noticeable difference. To resize the
browser, you can click and drag the left edge of the browser or click on the
expand icon: .
Learn
Bootstrap Containers
Bootstrap uses a grid system based on CSS Flexbox which organizes content in rows or columns.
As seen in the previous exercise, Bootstrap also uses rows and columns and in this exercise we’ll
learn about the essential Bootstrap container. Using the Bootstrap grid also allows for responsive
design, in other words, a website’s layout can change based on the user’s screen size. Read more
about grid at Bootstrap’s grid documentation.
Bootstrap uses classes to apply CSS rulesets — these rulesets dictate the layout and styling of the
element. To create a container, necessary for Bootstrap’s grid, we assign a class
of "container" to a <div> like so:
<div class="container"></div>
The <div> from the example above becomes a Bootstrap container which has a width relative to a
user’s screen size, becomes horizontally centered, and has a left and right margin.
If we wanted the container to take up the entire width of the screen we can assign a class
of "container-fluid":
<div class="container-fluid"></div>
Knowing how to use documentation is important. We can always check what classes to add
using Bootstrap’s grid documentation.
Note: the Bootstrap site uses CSS notation for classes, which entails having a . before a class
name like .example-class-name.
Instructions
1.
Note that we’ve added some styling in a local CSS file, style.css to add a background color, a
border, and a font color to the <div>s without adding more Bootstrap classes. This will be a
common theme in the following exercises. We’ve given containers a solid black border and a
teal/green background color.
Hint
Make sure you assign the class to the first <div>. Check the code in the narrative or Bootstrap’s
documentation for syntax help.
2.
You will have to resize the browser to see a noticeable difference. To resize the browser, you can
click and drag the left edge of the browser or click on the expand icon: .
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Containers</title>
</head>
<body>
<div class="container">
<h1>Container Example</h1>
</div>
<br>
<div class="container-fluid">
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
body {
.container, .container-fluid {
.row {
[class*="col"]{
}
LEARN BOOTSTRAP 4: GRID
Columns
We’ve covered containers and rows, now we have to go one level deeper and explore Bootstrap’s
columns.
Columns are the immediate children of rows and store content. By default, a column will take up
the entire width of its parent row. As we add more columns inside a row, the default behavior is
for each column’s width to be readjusted to fit in the row — each column will have the same
width. At most, a row will accommodate 12 columns. Study the diagram below to see how
column sizing works:
Notice the first row in the diagram has 1 column and it takes up the entire width of the row. We
could say that this column takes up the width of 12 individual columns. The width of an
individual column can be seen in the last row of the diagram.
To create a column, we assign an element with the class of "col". Take a look at the provided
example with a container that has a nested row which has a nested column:
<div class="container">
<div class="row">
<div class="col">
</div>
</div>
</div>
Let’s learn about this first hand by adding columns in our code!
Instructions
1.
In index.html we have 3 rows. Let’s see what happens when we add varying amounts of
columns to each row. We’ve given columns a solid border and a purple background color.
Nested inside the first row is a <div> without a class. Assign it a class of "col" to render a
column.
Stuck? Get a hint
2.
In the second row, add two columns using <div>s.
To give the column some height, inside each <div> add a <p> element with the text Two columns
in a row.
Hint
The second row should have two <div> children. Each <div> should have a class of "col".
To give the column some height, inside each <div> add a <p> element with the text Three columns
in a row.
Compare the sizing of the added columns. Also, expand the size of the browser to see responsive
design in action!
Hint
The third row should have two <div> children. Each <div> should have a class of "col".
Remember to add the <p> with the text Three columns in a row.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>Columns</title>
</head>
<body>
<div class="container">
<!--First row-->
<div class="row">
<div>
</div>
</div>
<!--Second row-->
<div class="row">
</div>
<!--Third row-->
<div class="row">
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
LEARN BOOTSTRAP 4: GRID
Columns
We’ve covered containers and rows, now we have to go one level deeper and
explore Bootstrap’s columns.
Columns are the immediate children of rows and store content. By default, a
column will take up the entire width of its parent row. As we add more
columns inside a row, the default behavior is for each column’s width to be
readjusted to fit in the row — each column will have the same width. At most,
a row will accommodate 12 columns. Study the diagram below to see how
column sizing works:
Notice the first row in the diagram has 1 column and it takes up the entire
width of the row. We could say that this column takes up the width of 12
individual columns. The width of an individual column can be seen in the last
row of the diagram.
<div class="container">
<div class="row">
<div class="col">
</div>
</div>
</div>
Let’s learn about this first hand by adding columns in our code!
Instructions
1.
In index.html we have 3 rows. Let’s see what happens when we add varying
amounts of columns to each row. We’ve given columns a solid border and a
purple background color.
Nested inside the first row is a <div> without a class. Assign it
a class of "col" to render a column.
Checkpoint 2 Passed
Hint
Make sure you’re assigning the <div> a class of "col". Your code will look like:
<div class="row">
<div class="col">
<h3>One column in a row</h3>
</div>
</div>
2.
In the second row, add two columns using <div>s.
To give the column some height, inside each <div> add a <p> element with the
text Two columns in a row.
Checkpoint 3 Passed
Hint
The second row should have two <div> children. Each <div> should have
a class of "col".
To give the column some height, inside each <div> add a <p> element with the
text Three columns in a row.
Compare the sizing of the added columns. Also, expand the size of the
browser to see responsive design in action!
Checkpoint 4 Passed
Hint
The third row should have two <div> children. Each <div> should have
a class of "col".
Remember to add the <p> with the text Three columns in a row.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>Columns</title>
</head>
<body>
<div class="container">
<!--First row-->
<div class="row">
<div class="col">
</div>
</div>
<!--Second row-->
<div class="row">
<div class="col">
<div class="col">
</div>
</div>
<!--Third row-->
<div class="row">
<div class="col">
</div>
<div class="col">
</div>
<div class="col">
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
Style.css
body {
.container, .container-fluid {
}
.row {
[class*="col"]{
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>Column Widths</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col">
<p>Differently</p>
</div>
<div class="col">
<p>Sized</p>
</div>
</div>
<div class="row">
<div class="col">
<p>Left Column</p>
</div>
<div class="col">
<p>Middle Column</p>
</div>
<div class="col">
<p>Right Column</p>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
body {
.container, .container-fluid {
.row {
background-color: rgb(236, 93, 23);
[class*="col"]{
}
Bootstrao design codeacademy
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>Column Widths</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-9">
<p>Differently</p>
</div>
<div class="col-3">
<p>Sized</p>
</div>
</div>
<div class="row">
<div class="col-3">
<p>Left Column</p>
</div>
<div class="col-6">
<p>Middle Column</p>
</div>
<div class="col-3">
<p>Right Column</p>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
Learn Bootstrap 4: Grid: Setting Column Width with Content
Narrative and Instructions
Learn
Another option we could use to set the width of a column is the content inside the column.
If we want to use the content to set a column’s width, we append "auto" to the class of the
column, for example:
<div class="col-auto">
<p>This content determines the width of the parent column</p>
</div>
In the example above, the width of the column is determined by the text inside the <p> element.
Instructions
1.
Currently, the column in the first row has a width of "12". Change the "12" so that the width of
the column is set by the content inside the column.
Notice the sizing difference after you successfully make the change.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Auto Width</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-auto">
<p>Auto Adjusted</p>
</div>
</div>
<div class="row">
<div class="col-auto">
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
Bootstrap categorizes screen sizes into 5 categories or as breakpoints: extra small, small,
medium, large, and extra large. Each breakpoint has a range measured in pixels. The
range of these breakpoints and accompanying device types are marked in the following
table:
Breakpoint
Category Device Type
Range
Extra < 576 px portrait
Breakpoint
Category Device Type
Range
small smartphones
landscape
Small ≥ 576 px
smartphones
Medium ≥ 768 px tablets
Large ≥ 992 px desktops
Extra
≥ 1200 px large desktop
Large
By using these breakpoints in combination with Bootstrap’s grid, we can customize the
layout of our content for different scr
Using Bootstrap, we can freely change the layout of our content using grid.
We can even customize how our content on the grid changes based on
breakpoints (extra small, small, medium, large, extra large). To incorporate
these breakpoints into our code, we have to follow Bootstrap’s class naming
convention.
For instance:
<div class="col-sm-8">
</div>
The column in the example will be as wide as 8 individual columns on small
screen sizes and also any larger screens (medium, large, and extra large). In
the next exercise, we’ll go over how to customize our layout for every
breakpoint. For now, let’s get comfortable with Bootstrap’s naming
convention. To get even more information check out Bootstrap’s grid options
documentation.
Instructions
1.
After you make this change, expand the size of the browser to a medium-sized
screen provided to see the change take place.
Checkpoint 2 Passed
Hint
You’ll need to add to the existing class="col" on the column. After you make
your changes, the class should look like: class="col-md-6". When you apply a
breakpoint, the width provided is also applied to the breakpoints of larger
screens.
Expand the browser until you see that the column takes up half the width of
the row, that’s when you know you’ve hit the breakpoint.
2.
In the second row, make both columns have a width of 3 on small (and larger)
sized screens.
Change the size of the browser to see the effect of the modified class!
Checkpoint 3 Passed
Hint
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-6">
<h3>6 columns wide:</h3>
</div>
</div>
<div class="row">
<div class="col-sm-3">
</div>
<div class="col-sm-3">
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
Style.css
body {
.container, .container-fluid {
.row {
[class*="col"]{
}
LEARN BOOTSTRAP 4: GRID
Let’s walk through the syntax and thought process using an example:
First, we’d want to think about how our column looks like on extra small
screens. Since we don’t have much space, we would want to have our column
take up the entirety of the row and assign a class of "col-12". We don’t include
an xs breakpoint, it’s implicitly applied for us! Our column looks like:
<div class="col-12">
</div>
Then we decide that for medium-sized screens we don’t want the column to
take up so much space, so we could set the width to 8. We use the Bootstrap
naming convention and add an additional class to the column like so:
Instructions
1.
Currently, our column has a class of col-12 which means that for any screen it
has a width of 12 individual columns.
Hint
Separate the classes using a space. Use the following syntax as reference:
Follow Bootstrap’s naming convention and add another class to the column
and set the width to 8 for medium-sized screens.
Checkpoint 3 Passed
3.
4.
Lastly, for extra large screens set the width of the column to 3.
Resize the provided browser to see all the breakpoints in action! Depending
on the size of your screen, you might not hit certain breakpoints.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>Combining Classes</title>
</head>
<body>
<div class="container">
<div class="row">
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
Instructions
create a 8 x 8 checkerboard.
nest a layer of rows and columns inside a column.
recreate the layout in the second exercise.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<link rel="stylesheet" href="style.css" type="text/css">
<title>Combining Classes</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-12">
<h3>Make Something!</h3>
<p>It's important to practice the skills you've learned in this lesson. That way you'll retain that
information!</p>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
https://www.codecademy.com/courses/learn-bootstrap/projects/bootstrap-grid-painting
LEARN BOOTSTRAP
Recreate a painting using Bootstrap's grid
In this project you will practice using the fundamentals of Bootstrap grid by piecing
together a famous painting, namely Piet Mondrian’s Composition II in Red, Blue, and
Yellow:
In index.html is a container with columns that represent various pieces in Composition
II. You can tell which piece is what by the element’s id and the comment inside the
column and with the labeled painting below:
The column’s height and colors, and the container’s height and width, are already
included in style.css. Your goal is to recreate the painting by:
using the existing container.
unscrambling the order of the provided columns.
adjusting the widths of the provided columns.
adding new rows and additional columns.
nesting row(s) inside columns.
There will not be step-by-step instructions provided, however, there are hints in the
steps if you get stuck along the way. Good luck and have fun!
Note: You might have to resize the browser to see the entire painting.
The column’s height and colors, and the container’s height and width, are already
included in style.css. Your goal is to recreate the painting by:
LEARN BOOTSTRAP
There will not be step-by-step instructions provided, however, there are hints
in the steps if you get stuck along the way. Good luck and have fun!
Note: You might have to resize the browser to see the entire painting.
If you get stuck during this project, check out the project walk-through
video which can be found in the help menu.
Tasks
0/4 Complete
The initial ordering of the columns is all scrambled! But you can use the
labeled diagram to help you unscramble the pieces.
If you’re more a visual person, you can add some text inside the element.
2.
You could also organize it differently but think about the painting in rows and
columns!
3.
You can nest rows inside columns. Those nested rows can also have additional
columns!
<div class="col">
<div class="row">
<div class="col">
<!-- Piece 1-->
</div>
</div>
<div class="row">
<div class="col">
<!-- Piece 2-->
</div>
</div>
</div>
In the example provided, there is a column with two nested rows. Each row
contains another column. When rendered, the Piece 1 column would rest on
top of the Piece 2 column.
Extra
4.
If you want some additional challenges:
LEARN BOOTSTRAP
In this project you will practice using the fundamentals of Bootstrap grid by
piecing together a famous painting, namely Piet Mondrian’s Composition II in
Red, Blue, and Yellow:
In index.html is a container with columns that represent various pieces
in Composition II. You can tell which piece is what by the element’s id and the
comment inside the column and with the labeled painting below:
The column’s height and colors, and the container’s height and width, are
already included in style.css. Your goal is to recreate the painting by:
There will not be step-by-step instructions provided, however, there are hints
in the steps if you get stuck along the way. Good luck and have fun!
Note: You might have to resize the browser to see the entire painting.
If you get stuck during this project, check out the project walk-through
video which can be found in the help menu.
Tasks
0/4 Complete
The initial ordering of the columns is all scrambled! But you can use the
labeled diagram to help you unscramble the pieces.
If you’re more a visual person, you can add some text inside the element.
2.
You could also organize it differently but think about the painting in rows and
columns!
3.
You can nest rows inside columns. Those nested rows can also have additional
columns!
<div class="col">
<div class="row">
<div class="col">
<!-- Piece 1-->
</div>
</div>
<div class="row">
<div class="col">
<!-- Piece 2-->
</div>
</div>
</div>
In the example provided, there is a column with two nested rows. Each row
contains another column. When rendered, the Piece 1 column would rest on
top of the Piece 2 column.
Extra
4.
If you want some additional challenges:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoP
kFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body>
<div class="container">
</div>
</div>
</div>
</div>
</div>
<div id="b" class="col">
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+
8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-
ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-
ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/
JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>
Style.css
.container {
width: 500px;
height: 505px;
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoP
kFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row">
<div clss="col-3"
<div id="a" class="col">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+
8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-
ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-
ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/
JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>
#a {
min-height: 165px;
#b {
min-height: 190px;
}
#c {
min-height: 355px;
#d {
min-height: 150px;
#e {
min-height: 150px;
}
#f {
min-height: 75px;
#g{
min-height: 75px;
}
LEARN BOOTSTRAP 4: UTILITIES AND COMPONENTS
Adding Colors
Bootstrap utility classes provide an element with styling and purpose. Let’s get
acquainted with utility classes by styling the color of our elements.
Let’s say we want to change the text color of our paragraph element from the
default black to blue. We would add a class of "text-primary", like so:
<div class="bg-success">
Green! This signifies success!
</div>
In the example above, we’ve assigned the <div> element a class of "bg-
success". The "bg" part references the element’s background
and "success" changes the background color to green. We can also tell from
the name of the class that this <div> element is meant to be used when
something happened/worked. We can find more background utility classes
at Bootstrap’s background color examples.
To get the full range of what we can do with Bootstrap’s color utility classes,
check out Bootstrap’s colors documentation. Now, let’s add some color to our
own examples.
Instructions
1.
Change the text color of the <p> element to yellow by assigning its class a
value of "text-warning".
Checkpoint 2 Passed
Hint
Hint
Hint
<div class="bg-success">
...
</div>
Then to make the text white, add another class of "text-white":
Community Forums
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
</head>
<body>
<p class="text-warning">
</p>
<div class="bg-info">
</div>
<br>
Alright, we want to have a green background AND change the text color to white.
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
Styling Text
If we want to style and format text, we can use Bootstrap’s text utility classes.
For instance, if we want our text to be bold, we could add a class of "font-
weight-bold" like so:
<p class="font-weight-bold">
This rendered text is bold.
</p>
We can also combine Bootstrap classes for additional styling. Let’s say we
wanted our text to also be uppercased. We would add "text-uppercase" to the
class attribute:
Instructions
1.
Hint
Since you want to make all the text in uppercase, you want to transform the
text, so look at: Bootstrap’s text transform documentation.
2.
Let’s keep styling our text! This time, add a utility class to the <p> and make the
text italicized.
We should add one more class to practice our documentation reading skills.
Browse Bootstrap’s documentation to find the utility class that will right align
the <p> element’s text.
Hint
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
</head>
<body>
After you've assigned the appropriate class to make this text uppercased, assign another class to make
this text italicized.
</p>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
<p class="font-weight-bold text-uppercase font-italic">
First, assign a class to style this text so that it is entirely uppercased.
After you've assigned the appropriate class to make this text uppercased, as
sign another class to make this text italicized.
Finally, browse Bootstrap's documentation to right align this text.
</p>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
</head>
<body>
After you've assigned the appropriate class to make this text uppercased, assign another class to make
this text italicized.
</p>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
Learn
Styling Text
If we want to style and format text, we can use Bootstrap’s text utility classes.
For instance, if we want our text to be bold, we could add a class of "font-weight-bold" like so:
<p class="font-weight-bold">
This rendered text is bold.
</p>
We can also combine Bootstrap classes for additional styling. Let’s say we wanted our text to
also be uppercased. We would add "text-uppercase" to the class attribute:
Instructions
1.
In the <body>, there is an unstyled <p> that we can practice styling on.
Let’s first make the <p>‘s text entirely uppercased by assigning it a class of "text-uppercase".
Checkpoint 2 Passed
Hint
Since you want to make all the text in uppercase, you want to transform the text, so look
at: Bootstrap’s text transform documentation.
2.
Let’s keep styling our text! This time, add a utility class to the <p> and make the text italicized.
We should consult Bootstrap’s font weight and italics documentation for what utility class to
add.
Checkpoint 3 Passed
3.
We should add one more class to practice our documentation reading skills.
Browse Bootstrap’s documentation to find the utility class that will right align the <p> element’s
text.
Checkpoint 4 Passed
Hint
Element Positioning
For example, if we want an element that is fixed to the top, we can apply
a "fixed-top" class:
<div class="fixed-top">
This div will be fixed at the top of the screen.
</div>
There are a few other positioning utility classes, so let’s explore how to use
them!
Instructions
1.
Hint
Look over Bootstrap’s sticky top example to apply the sticky top utility class.
2.
Now the <h1> element should stick to the top even after we’ve scrolled past it.
Let’s also fix the <footer> to the bottom of the page using a Bootstrap utility
class. You’ll have to scroll to the bottom of index.html to find
the <footer> element.
Check the hint for documentation help.
Checkpoint 3 Passed
Hint
To apply Bootstrap’s fixed bottom utility class, take a look at: Bootstrap’s fixed
bottom example.
There are many ways to create a basic nav component. Here’s one example:
<ul class="nav">
<li class="nav-item">
<a class="nav-link" href="#">First Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Second Link</a>
</li>
</ul>
In the above example:
<nav class="nav">
<a class="nav-link" href="#">First Link</a>
<a class="nav-link" href="#">Second Link</a>
</nav>
Notice that we still have the parent element with a class of "nav" and the
children elements with a class of "nav-link". Both examples render the same
links, but we might choose one example over the other depending on how we
want our layout to look.
Instructions
1.
We’ll begin the process of piecing together a gardening website using various
Bootstrap components.
Let’s utilize the navigation component we learned about and transform the
current <nav>.
2.
Hint
The ordering of the element’s attributes doesn’t matter. You can add the class
before or after the href.
3.
Find out what class to add the nav component using Bootstrap’s Nav
documentation.
Checkpoint 4 Passed
Hint
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>Gloria's Gardening</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col">
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
LEARN BOOTSTRAP 4: UTILITIES AND COMPONENTS
It has a type of "button".
It has two classes, "btn" and "btn-danger".
o The "btn" class provides Bootstrap’s default button styling.
o The "btn-danger" turns the button red and conveys the purpose of
the button, i.e. clicking this button might not be safe!
Visit Bootstrap’s button documentation for a comprehensive list of how to
create and use button components.
We’ll add some interactivity and make the buttons do something in the
following exercises. For now, let’s practice creating Bootstrap button
components.
Instructions
1.
For the Click here for more info button, it already has a class of "btn". We
want to add a class to give this button a teal color.
2.
3.
Now use your documentation reading skills and make the This button acts
like a link button resemble an actual link.
Hint
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>Gloria's Gardening</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col">
<!-- Make the button used for information and teal colored -->
</button>
<!-- Make the button signify success and green colored -->
Plant now
</button>
<!-- Make the button resemble a link instead of a traditional button -->
</div>
</div>
<div class="row">
<div class="col">
</nav>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
Creating a Navbar
Let’s combine our knowledge of collapse, buttons, and the nav component to
make a responsive navbar! We often find navbars at the top of websites and
we can use a navbar to quickly navigate to useful/important pages on the
website.
Instructions
1.
We have some HTML in place for a navbar but we have to add some classes to
make it a responsive Bootstrap navbar component.
Use the comments to locate the navbar component. The <nav> already has two
classes for styling. You will have to add two more
classes: "navbar" and "navbar-expand-sm".
Checkpoint 2 Passed
Hint
<img src="https://content.codecademy.com/courses/learn-
bootstrap-components/logo.png" alt="Gloria's Gardening Logo"
height="30">
Checkpoint 3 Passed
Hint
You can provide an href="#" attribute if you want but it’s not necessary to pass
the checkpoint.
3.
The <button> and the collapsible <div> is already included, but we still need to
make the <ul> and accompanying <li> and <a> elements into a nav
component.
Hint
The HTML elements already exist, you have to assign the correct class to each
element.
4.
Notice after you add the change and run your code that the "Home" text has a
subtle styling difference compared to the other two links in the navbar.
Checkpoint 5 Passed
Hint
If you have a small screen, you may have to click on the button on the navbar
to view the links.
Community Forums
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
crossorigin="anonymous">
<title>Gloria's Gardening</title>
</head>
<body>
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/logo.png"
alt="Gloria's Gardening Logo" height="30">
</a>
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row">
data-toggle="collapse" href="#seedSpecial">
Gearing to Grow?
</a>
<p class="collapse" id="seedSpecial">Use promo code "GGarden" for additional 15% off your entire
purchase!
</p>
</div>
</div>
<div class="col">
</nav>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
LEARN BOOTSTRAP 4: UTILITIES AND COMPONENTS
<div class="jumbotron">
<h1>Wow this stands out!</h1>
</div>
In the example above we included an <h1> element, but we could add images
or a variety of Bootstrap components. Look over Bootstrap’s jumbotron
documentation for more elaborate examples.
Instructions
1.
Use the comments to locate where you’ll put the jumbotron component.
Inside the column of that row, add a <div> and assign it a class of "jumbotron".
Checkpoint 2 Passed
2.
Inside the jumbotron, add some content relevant to Gloria’s Gardening! It can
be anything you want, just make sure it’s not blank!
Checkpoint 3 Passed
Hint
Add some content inside the jumbotron. You can add text, or an image, or
both, see what you can do!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>Gloria's Gardening</title>
</head>
<body>
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/logo.png"
alt="Gloria's Gardening Logo" height="30">
</a>
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row">
</a>
<p class="collapse" id="seedSpecial">Use promo code "GGarden" for additional 15% off your entire
purchase!
</p>
</div>
</div>
<div class="row">
<div class="col">
<div class="jumbotron">
<hr>
<p>We've got a wide selection of plants, seeds, tips to transform your garden.</p>
</div>
</div>
</div>
<div class="row">
<div class="col">
</nav>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
LEARN BOOTSTRAP 4: UTILITIES AND COMPONENTS
Adding a Card
Bootstrap also has a card component that serves as a container for smaller customized content.
Card components are often grouped together to display a collection of similar content in
manageable chunks. We can draw a comparison of the card component to playing cards in deck
— in both cases, there are cards grouped together and each one contains something different.
<div class="card">
<img class="card-img-top" src="placeholder.jpg" alt="card example
image">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Card description goes here.</p>
<a href="#" class="card-link">Link to somewhere.</a>
</div>
</div>
Let’s highlight a few key points from the example:
Let’s add some of our own cards, remember to check Bootstrap’s card documentation for more
customizations!
Instructions
1.
Under the jumbotron is a row with 2 nested columns set up for our card components.
Inside the first column, add a <div> and assign it a class of "card". We’ll be making a garden
related card for the webpage.
Checkpoint 2 Passed
Hint
Look for the comment Add your first card below and add your code inside that column.
2.
Use the Bootstrap’s card documentation to add a header.
The text in the header should read Planting in the spring. Check the hint if you need help
navigating the documentation:
Checkpoint 3 Passed
Hint
Bootstrap’s card header and footer section has an example for how to add a header.
<div class="card">
<div class="card-header">
Planting in the spring
</div>
</div>
3.
Below the header add an image that renders at the top of the card.
https://content.codecademy.com/courses/learn-bootstrap-components/
flowers.png
Also, remember to assign the appropriate class.
Checkpoint 4 Passed
Hint
<div class="card">
<div class="card-header">
Planting in the Spring
</div>
<img class="card-img-top"
src="https://content.codecademy.com/courses/learn-bootstrap-
components/flowers.png" alt="planting in the spring">
</div>
4.
Inside the <div> you just made, add <p> with a class of "card-text". The text should read It's
almost spring time, get your seeds ready for planting!
Checkpoint 5 Passed
Hint
Browse Bootstrap’s card titles, text, and links section for a more detailed example.
<div class="card">
<div class="card-header">
Planting in the Spring
</div>
<img class="card-img-top"
src="https://content.codecademy.com/courses/learn-bootstrap-
components/flowers.png" alt="planting in the spring">
<div class="card-body">
<p class="card-text">
It's almost Spring time, get your seeds ready for planting!
</p>
</div>
</div>
5.
Great job adding a card to the page. Now, add your own customized card to the 2nd column!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>Gloria's Gardening</title>
</head>
<body>
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/logo.png"
alt="Gloria's Gardening Logo" height="30">
</a>
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row">
Gearing to Grow?
</a>
<p class="collapse" id="seedSpecial">Use promo code "GGarden" for additional 15% off your entire
purchase!
</p>
</div>
</div>
<div class="row">
<div class="col">
<hr>
<p>Got a passion for planting? A need for seeds? A desire to dig? Well, then you've come to the
right place.
</p>
<p>We've got a wide selection of plants, seeds, tips to transform your garden.</p>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
</div>
<div class="card-body">
It's almost spring time, get your seeds ready for planting!
</p>
</div>
</div>
</div>
<div class="col">
<div class="card-header">
</div>
<div class="card-body">
If you have a greenhouse or just love these bright colors. Try planting these tropical flowers!
</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>Gloria's Gardening</title>
</head>
<body>
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/logo.png"
alt="Gloria's Gardening Logo" height="30">
</a>
<span class="navbar-toggler-icon"></span>
</button>
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row">
Gearing to Grow?
</a>
<p class="collapse" id="seedSpecial">Use promo code "GGarden" for additional 15% off your entire
purchase!
</p>
</div>
</div>
<div class="row">
<div class="col">
<hr>
<p>Got a passion for planting? A need for seeds? A desire to dig? Well, then you've come to the
right place.
</p>
<p>We've got a wide selection of plants, seeds, tips to transform your garden.</p>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
</div>
<img class="card-img-top" src="https://content.codecademy.com/courses/learn-bootstrap-
components/flowers.png" alt="flowers in bloom">
<div class="card-body">
It's almost spring time, get your seeds ready for planting!
</p>
</div>
</div>
</div>
<div class="col">
<div class="card-header">
</div>
<div class="card-body">
If you have a greenhouse or just love these bright colors. Try planting these tropical flowers!
</p>
</div>
</div>
</div>
</div>
<!-- End of row with cards -->
<div class="row">
<div class="col">
</nav>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
LEARN BOOTSTRAP 4: UTILITIES AND COMPONENTS
There are times that we want to showcase a group of images but not want to
have our users scroll through one picture on top of another. Instead, we could
fit our images into a slideshow using Bootstrap’s carousel component.
Instructions
1.
2.
Now that the carousel is in place, let’s add some controls for users to click
through the slides.
There are times that we want to showcase a group of images but not want to have our users scroll
through one picture on top of another. Instead, we could fit our images into a slideshow using
Bootstrap’s carousel component.
Bootstrap has many carousel examples but let’s go through a basic example together:
Instructions
1.
The HTML skeleton of a carousel is already in index.html but you need to add the appropriate
class values to the <div> elements. The parent <div> element should also have a data-
ride attribute with the appropriate value.
Hint
Also, add the class "active" to a <div> that has a class of "carousel-item", otherwise, the images
won’t appear!
2.
Now that the carousel is in place, let’s add some controls for users to click through the slides.
You have to use Bootstrap’s with controls example to implement this feature. Check out the hint
for additional help!
Checkpoint 3 Passed
Hint
You can copy and paste both <a> elements inside the carousel’s parent <div>. However,
remember to change the value of the href to match the value of the parent <div>‘s id.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Gloria's Gardening</title>
</head>
<body>
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/logo.png"
alt="Gloria's Gardening Logo" height="30">
</a>
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar-nav">
</li>
<li class="nav-item">
<li class="nav-item">
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row">
Gearing to Grow?
</a>
<p class="collapse" id="seedSpecial">Use promo code "GGarden" for additional 15% off your entire
purchase!
</p>
</div>
</div>
<div class="row">
<div class="col">
<div class="jumbotron p-3">
<hr>
<p>Got a passion for planting? A need for seeds? A desire to dig? Well, then you've come to the
right place.
</p>
<p>We've got a wide selection of plants, seeds, tips to transform your garden.</p>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="card-header">
</div>
<div class="card-body">
It's almost Spring time, get your seeds ready for planting!
</p>
</div>
</div>
</div>
<div class="col">
<div class="card-header">
</div>
<div class="card-body">
If you have a greenhouse or just love these bright colors. Try planting these tropical flowers!
</p>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col">
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/garden-
slide1.jpg" class="d-block w-100" alt="butterfly in field">
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/garden-
slide2.jpg" class="d-block w-100" alt="colorful tulips">
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/garden-
slide3.jpg" class="d-block w-100" alt="inside of a greenhouse">
</div>
</div>
<span class="sr-only">Previous</span>
</a>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
<div class="row">
<div class="col">
</nav>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
Now, go forth and see what else you can bootstrap to your site!
Instructions
If you want to challenge yourself:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-
MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<title>Gloria's Gardening</title>
</head>
<body>
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/logo.png"
alt="Gloria's Gardening Logo" height="30">
</a>
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar-nav">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row">
Gearing to Grow?
</a>
<p class="collapse" id="seedSpecial">Use promo code "GGarden" for additional 15% off your entire
purchase!
</p>
</div>
</div>
<div class="row">
<div class="col">
<hr>
<p>
Got a passion for planting? A need for seeds? A desire to dig? Well, then you've come to the right
place.
</p>
<p>
We've got a wide selection of plants, seeds, tips to transform your garden.
</p>
</div>
</div>
</div>
<!-- End of row with jumbotron component -->
<div class="row">
<div class="col">
<div class="card-header">
</div>
alt="flowers in bloom">
<div class="card-body">
It's almost Spring time, get your seeds ready for planting!
</p>
</div>
</div>
</div>
<div class="col">
<div class="card-header">
</div>
<div class="card-body">
If you have a greenhouse or just love these bright colors. Try planting these tropical flowers!
</p>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col">
<div class="carousel-inner">
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/garden-
slide1.jpg"
</div>
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/garden-
slide2.jpg"
<div class="carousel-item">
<img src="https://content.codecademy.com/courses/learn-bootstrap-components/garden-
slide3.jpg"
</div>
</div>
<span class="sr-only">Previous</span>
</a>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
<div class="row">
<div class="col">
</nav>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
LEARN BOOTSTRAP
Adhoc
Let’s make full use of our Bootstrap knowledge and its accompanying documentation to
create a website for Adhoc, an office administration website. Check out Adhoc’s design
spec for more information. You also have the option of not following the steps/design
spec and creating a website of your own design!
Adhoc logo.
jumbotron background.
experienced icon.
fun icon.
smart icon.
picture of Brian M. the CEO.
picture of Andy C. the CFO.
picture of Angela W. the COO.
picture of Amie S. the CTO.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
integrity="sha384-
GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
crossorigin="anonymous">
<title>Adhoc</title>
</head>
<body>
<span class="navbar-toggler-icon"></span>
</button>
</li>
<li class="nav-item">
</li>
aria-haspopup="true" aria-expanded="false">
Dropdown
</a>
<div class="dropdown-divider"></div>
</div>
</li>
<li class="nav-item">
</li>
</ul>
</form>
</div>
</nav>
</div>
<div class="container">
<div class="row">
<div class="col">
</div>
</div>
<hr>
<div>
</div>
<div class="row">
<div class="col">
</div>
</div>
<div class="row">
<div class="col">
<div class="col">
</div>
<div class="col">
</div>
</div>
<div class="row">
<div class="col">
</div>
</div>
<div class="row">
<div class="col">
<div class="carousel-inner">
</div>
<div class="carousel-item">
</div>
<div class="carousel-item">
</div>
<div class="carousel-item">
</div>
</div>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button"
data-slide="next">
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE
1Pi6jizo" crossorigin="anonymous"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"
integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA
6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"
integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/
mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
</body>
</html>
LEARN BOOTSTRAP
Adhoc
Let’s make full use of our Bootstrap knowledge and its accompanying
documentation to create a website for Adhoc, an office administration
website. Check out Adhoc’s design spec for more information. You also have
the option of not following the steps/design spec and creating a website of
your own design!
Adhoc logo.
jumbotron background.
experienced icon.
fun icon.
smart icon.
picture of Brian M. the CEO.
picture of Andy C. the CFO.
picture of Angela W. the COO.
picture of Amie S. the CTO.
Remember, as you code along, save your code in order to see your changes
reflected in the browser!
Tasks
21/21 Complete
Mark the tasks as complete by checking them off
Getting Ready
1.
Also, check out the links provided for the images used on the website.
Lastly, look over the provided code in index.html. You’ll see some starter
code that you’ll have to edit in order to have a functioning site.
Editing the Navbar
2.
Let’s first tackle the navbar, but notice that there’s already some code there!
That’s the code copied from Bootstrap’s navbar example.
It’s a good starter template but we still have to edit this code to fit our needs.
Therefore, remove the code that renders these elements:
Hint
Remove both the dropdown and disabled links. The code below is not
necessary:
Use the second link as a template and make 2 additional links. Change the text
of the links to follow the design spec.
Hint
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
and paste it two more times to create the links.
Under the navbar, there’s a <div> that we’re going to turn into our jumbotron!
</div>
Check out Bootstrap’s jumbotron documentation for more information!
6.
Inside the jumbotron, add another <div>. This new <div> is going to act as a
background and container for the text we want to insert. Therefore, inside
the <div> add an <h1> element followed by a <p>.
Use the design spec and add the appropriate text inside both the <h1> and
the <p> elements.
Hint
<div>
<h1>Big Text Here</h1>
<p>Smaller Text Here</p>
</div>
7.
Time to style the elements we just added. We want the new <div> to have:
a grey background.
white and centered text.
larger top and bottom margins by assigning a class of "my-5". This utility
class targets and increases the vertical margins of an element.
To make the text centered, use one of Bootstrap’s text alignment utility
classes.
italic font.
a light font-weight.
Finish up the quote styling by increasing the top and bottom margins of the
column containing the quote. You can do so by assigning a class of my-5.
Hint
To give the text some styling, use Bootstrap’s font weight and italics utility
classes.
To make the text aligned, use one of Bootstrap’s text alignment utility classes.
Center the text and give it a display heading that follows the design spec.
Hint
To make the text aligned, use one of Bootstrap’s text alignment utility classes.
10.
In the next row, we’re going to continue following the design spec and add
one card in each column.
experienced icon.
fun icon.
smart icon.
Hint
Look over Bootstrap’s card example for the syntax used to create a card.
While the columns look good on a large screen, the contents look squished on
a smaller screen. Change the width of the column so that it has a width of 4 on
medium, and larger, sized screens.
For extra small and small-sized screens, it should have a width of 8.
Hint
Look over Bootstrap’s grid mix and match example for the syntax used to
create responsive columns.
12.
Let’s also have the row center the columns containing the cards.
Hint
Increase the vertical margins of the row with the text Why Adhoc and the row
containing the cards to space out the rows.
Hint
It’s up to you to decide how far apart the rows should be. Go ahead and
exercise your creative muscles!
Locate the row with the text Meet the Team. According to the design spec,
provide that row with utility classes that render a dark background with
rounded top border.
Hint
Give the bottom row a dark background and a rounded bottom border.
Stuck? Get a hint
17.
Take a look at the code that renders a carousel. It was copied directly
from Bootstrap’s carousel with controls example.
Like with the navbar, we’re going to modify the code to fit our needs. For
each <div> with a class of "carousel-item", assign the nested <img>‘s src a URL
to the provided pictures in the intro’s image assets. Also, provide an
appropriate value for the alt attribute.
With the slides set up, we can add some captions to each slide.
Style the captions so that it has a black background, no vertical padding, and a
rounded-pill border.
Inside the captions, add the appropriate text and style it according to the
design spec.
Hint
The captions will not show up if there isn’t any displayed text. You can render
the text using a <p> element with a nested <span> element like so:
<p>CEO: <span>Brian</span></p>
You can then apply some of Bootstrap’s text utility classes for styling. You’ll
also have to remove the <p>‘s bottom margin to eliminate the space below the
text.
Change the sizing of the carousel to only take up 50% of the width and set the
margin to automatically center its contents.
Then go back and adjust the spacing of the rows to follow the design spec.
Hint
To change the spacing of the rows, edit the row’s padding using Bootstrap’s
spacing utility classes.
Finishing up
20.
There are different ways to re-create the layout of the website, so figure out
what works best for you!
https://www.codecademy.com/paths/front-end-engineer-career-path/tracks/fecp-introduction-to-the-
front-end-engineer-career-path/modules/fecp-welcome/informationals/fecp-additional-resources