Bootstrap Cheat Sheet Flashcards

Understand the most important concepts, syntax, and "things to do" using Bootstrap CSS templates.

1
Q

Name at least 10 of the most common Bootstrap classes you might want to use in a web application.

If you can get 20 or more, you’re pretty good!

A
Alerts
Forms
Navbar
Badges
Buttons
Button Groups
Button Modifiers
Cards
Carousel
Collapse
Dropdowns
Form Input Groups
Custom Forms
Grids
Images
Jumbotron
List Group
Media Objects
Modal
Navs
Pagination
Popover
Progress
Utility: Display
Utility: Flexbox
Utility: Misc
Utility: Positioning
Utility: Borders
Utility: Colors
Utility: Sizing
Utility: Spacing
Utility: Text
Spinner
Tables
toast
tooltip
Typography
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Popper.js and how is it used?

A

Popper.js is a positioning engine, its purpose is to calculate the position of an element to make it possible to position it near a given reference element.

< !DOCTYPE html >
< html >
  < head >
    < title >Popper Tutorial< /title >
  < /head >
  < body >
    < button id="button" aria-describedby="tooltip" >My button< /button >
    < div id="tooltip" role="tooltip" >My tooltip< /div >
    < script src="https://unpkg.com/@popperjs/core@2" >< /script >
    < script >
      const button = document.querySelector('#button');
      const tooltip = document.querySelector('#tooltip');
  const popperInstance = Popper.createPopper(button, tooltip);
< /script >   < /body > < /html >

Popper.js is only required for Bootstrap 4, and everything except tooltips, popovers, dropdowns, modals can still be used.

Popper itself is most commonly used for pop-up tooltips that come to exist based on some action on the page. See Popper on Google for examples.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The bootstrap grid is divided into _____ columns

A

12 columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain how the different columns sizes on bootstrap apply to different devices:

A
col-lg-2 // class used for large devices like laptops
col-md-2 // class used for medium devices like tablets
col-sm-2// class used for small devices like mobile phones
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In Bootstrap, content MUST be placed within…

A

Columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What Bootstrap CSS class name would you use to make a full width container in Bootstrap?

A

.container-fluid { … }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

If you want to have 3 equal columns in Bootstrap, which CSS class would you use?

A

.col-md-4

Choose the multiple of 12 which is closest to match what you need.

The letters in between indicate sm small – md medium – lg large

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which of the following is correct about Bootstrap Responsive Images?

A- Bootstrap 3 allows you to make the images responsive by adding a class .img-responsive to the img tag.

B - .img-responsive class applies max-width: 100%; and height: auto; to the image so that it scales nicely to the parent element.

C - Both of the above

A

C. Both

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you style a basic table with llight padding and horizontal dividers?

A

Add the .table bootstrap class to the table:

< table class="table" >
  < thead >
    < tr >
      < th scope="col" >#< /th >
      < th scope="col" >First Name< /th >
      < th scope="col" >Last Name< /th >
      < th scope="col" >Handle< /th >
    < /tr >
  < /thead >
  < tbody >
    < tr >
      < th scope="row" >1< /th >
      < td >Mark< /td >
      < td >Otto< /td >
      < td >@mdo< /td >
    < /tr >
    < tr >
      < th scope="row" >3< /th >
      < td >Larry< /td >
      < td >the Bird< /td >
      < td >@twitter< /td >
    < /tr >
  < /tbody >
< /table >
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which of the following bootstrap style of button indicates a successful or positive action?

A - .btn
B - .btn-primary
C - .btn-success
D - .btn-info

A

C.

btn-success

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which of the following bootstrap style of image makes the entire image round by adding border-radius:500px?

A - .img-rounded
B - .img-circle
C - .img-thumbnail
D - None of the above.

A

B.

.img-circle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following bootstrap style is used to add text to .navbar?

A - .navbar-text
B - .text
C - .form-text
D - None of the above.

A

A.

To wrap strings of text in an element use the class .navbar-text. This is usually used with <p> tag for proper leading and color.</p>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Explain about the .pagination class in bootstrap

A
< div class="container" >
  < h2 >Pagination< /h2 >
  < p >The .pagination class provides pagination links:< /p >                  
  < ul class="pagination" >
    < li >< a href="#">1< /a >< /li >
    < li >< a href="#">2< /a >< /li >
    < li >< a href="#">3< /a >< /li >
    < li >< a href="#">4< /a >< /li >
    < li >< a href="#">5< /a >< /li >
  < /ul >
< /div >

This creates a small series of boxes with links to each possible page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which of the following is correct about Bootstrap jumbotron?

A - This component can optionally increase the size of headings and add a lot of margin for landing page content.
B - To use the Jumbotron: Create a container <div> with the class of .jumbotron.
C - Both of the above.
D - None of the above.</div>

A

C. Both

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Explain about the .panel-footer Bootstrap CSS class

A

You can add footers to panels by wrapping buttons or secondary text in a < div > containing class .panel-footer< /div >

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which class provides a responsive fixed width container?

A

.container

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which class provides a full width container, spanning the entire width of the viewport?

A

.container-fluid

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Which class adds zebra-stripes to a table?

A

.table-striped

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Which class shapes an image to a circle?

A

.img-circle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Which class is used to create a big box for calling extra attention?

A

.jumbotron

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Which button class is used to create a large button?

A

.btn-lg

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Which class is used to create a button group?

A

.btn-group

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

How can you insert a search icon using Bootstrap?

A

< span class=”glyphicon glyphicon-search” >< /span >

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Which bootstrap class adds a heading to a panel?

A

.panel-heading

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Which bootstrap class indicates a dropdown menu?

A

.dropdown

26
Q

A standard navigation tab is created with:

A

< ul class=”nav nav-tabs” >

27
Q

A standard navigation bar is created with:

A

< nav class=”navbar navbar-default” >

28
Q

Which class is used to create a black navigation bar?

A

.navbar-inverse

29
Q

Which plugin is used to cycle through elements, like a slideshow?

A

Carousel

30
Q

Which plugin is used to create a modal window?

A

Modal

31
Q

Bootstrap’s global default line-height

A

1.428

32
Q

How can you insert a search icon?

A

< span class=”glyphicon glyphicon-search” > < /span >

33
Q

What are the three main elements of the Bootstrap grid listed in the proper order.

A

CRC = .container > .row > .col

34
Q

Match the right Bootstrap breakpoint keyword to the correct media query starting point

HINT: This is about pixel widths on devices matches to Bootstrap keywords

A
xs  <576px
sm ≥576px
md ≥768px
lg ≥992px
xl ≥1200px
35
Q

Fill in the blank: Setting a grid tier of .col-sm-6 says ___________

A

Make this div 6 columns wide on the sm breakpoint and everything ABOVE

36
Q

In Bootstrap 4, 1 rem = _____ px?

A

16px

37
Q

Show how to use a card: code example

A

< div class=”card” >
< img class=”-img-top” src=”” alt=”image” >
< div class=”
-block” >
< h4 class=”-title” >Card title< /h4 >
< p class=”
-text” >Copy< /p >
< a href=”#” class=”btn btn-primary” >Link< /a >
< /div >
< /div >

38
Q

Which bootstrap styles are used to create a vertical pills navigation?

A

.nav, .nav-pills, .nav-stacked

39
Q

Which of the following aspect ratio is used with responsive video in bootstrap?

A. Embed-responsive-4by3
B. Embed-responsive-16by9
C. Both
D. None

A

C. Both

Embed-responsive-4by3
Embed-responsive-16by9

40
Q

About Bootstrap cross-browser compatibility which of the following is right?

A. Bootstrap use Normalize to establish cross browser compatibility
B. Normalize.css is a modern, HTML5-ready alternative to CSS resets
C. Normalize.css is a CSS file that provides cross-browser compatibility in the default styling of HTML elements
D. All of the above

A

D. All of the above

41
Q

create a button as a link in bootstrap?

A

.btn-link

42
Q

Default size of H6 bootstrap heading

A

12px

43
Q

How do you use a carousel? Show the HTML code for creating and using a bootstrap carousel.

A

< div id=”carouselExampleControls” class=”carousel slide” data-ride=”carousel” >
< div class=”carousel-inner” >
< div class=”carousel-item active” >
< img class=”d-block w-100” src=”…” alt=”First slide” >
< /div >
< div class=”carousel-item” >
< img class=”d-block w-100” src=”…” alt=”Second slide” >
< /div >
< div class=”carousel-item” >
< img class=”d-block w-100” src=”…” alt=”Third slide” >
< /div >
< /div >
< a class=”carousel-control-prev” href=”#carouselExampleControls” role=”button” data-slide=”prev” >
< span class=”carousel-control-prev-icon” aria-hidden=”true” > < /span >
< span class=”sr-only” > Previous< /span >
< /a >
< a class=”carousel-control-next” href=”#carouselExampleControls” role=”button” data-slide=”next” >
< span class=”carousel-control-next-icon” aria-hidden=”true” > < /span >
< span class=”sr-only” > Next< /span >
< /a >
< /div >

44
Q

Describe about the differences between Bootstrap 3 and Bootstrap 4.

(If you can say 3 sentences about the differences, you’re pretty good!)

A

Bootstrap 4 is written using Flexbox Grid, whereas Bootstrap 3 was written using the float method.

Bootstrap 4 uses rem CSS units whereas Bootstrap 3 uses px.

Panels, thumbnails, and wells have been dropped entirely for bootstrap 4.

Bootstrap 3 uses LESS while Bootstrap 4 uses SASS

45
Q

Name 5 different table classes in bootstrap

A
table
table-striped
table-bordered
table-hover
table-condensed
46
Q

Name all the Bootstrap color names:

A
CSS Class applied to paragraph or link:
.text-primary  LIGHT BLUE
.text-secondary   GREY
.text-success    GREEN
.text-danger    RED
.text-warning  ORANGE
.text-info  TEAL
.text-light  MILKY WHITE
.text-dark  DARK GREY
.text-muted   LIGHT GREY
.text-white   OFF WHITE
CSS Class Applied to Divs: 
.bg-primary
.bg-secondary
.bg-success
.bg-danger
.bg-warning
.bg-info
.bg-light
.bg-dark
.bg-white
47
Q

Make an alert message that is closeable in HTML using the Bootstrap CSS classes:

A

< div class=”alert alert-success alert-dismissible” >
< button class=”close” data-dismiss=”alert” >X< /button >
Alert message goes here.
< /div >

48
Q

Add a Bootstrap class to let a button span the entire width of the parent element. (Show HTML code)

A

< button class=”btn btn-primary btn-block” > Button < /button >

49
Q

Show how to create a button grouping of 3 buttons in using Bootstrap CSS classes (show the HTML code)

A

< div class=”btn-group btn-group-lg” >
< button class=”btn btn-primary” > Apple
< button class=”btn btn-primary” > Samsung < /button >
< button class=”btn btn-primary” > Sony < /button >
< /div >

btn-group-lg is optional but makes a bigger box.

50
Q

Show how to create a VERTICAL grouping of 3 buttons using Bootstrap CSS classes (show the HTML code)

A

< div class=”btn-group-vertical” >
< button class=”btn btn-primary”> Apple button >
< button class=”btn btn-primary” > Samsung button >
< button class=”btn btn-primary” > Sony button >
< /div >

51
Q

Show how to make a button group of 3 buttons that spans the entire width of its container.

A

< div class=”btn-group-justified” >
< button class=”btn btn-primary” > Apple
< button class=”btn btn-primary” > Samsung
< button class=”btn btn-primary” > Sony
< /div >

52
Q

How do you make a search button using Bootstrap?

HINT: glyphicon

A

< span class=”glyphicon glyphicon-search” >< /span >

53
Q

How do you make a print button using Bootstrap?

HINT: glyphicon

A

< span class=”glyphicon glyphicon-print” > < /span >

54
Q

How do you add a “badge” around text using Bootstrap?

Show a badge inside of a button.

Show a badge inside of a heading.

A

< button > Comments
< span class=”badge” > 2 < /span >
< /button >

< h4 > Example heading < span class=”badge badge-secondary” > New < /span > < /h4 >

55
Q

How do you make a label using Bootstrap? Show the usage of a label inside of a header element.

A

< h3 > Ice Cream
< span class=”label label-default” > YES < /span >
< /h3 >

56
Q

Use Bootstrap to make a progress bar on an HTML page.

Hint: nested div

A
< div class="progress" >
  < div class="progress-bar active" role="progressbar"
    style="width:70%" >
  < /div >
< /div >
57
Q

Create a simple pagination menu using Bootstrap. Make it contain 3 pages (links).

Show the HTML code

A
< ul class="pagination" >
  < li >< a href="#" >1< /a >< /li >
  < li >< a href="#" >2< /a >< /li >
  < li > < a href="#" >3 < /a>
< /ul >
58
Q

Create a basic (default) Bootstrap Panel with the words: “Hello World”.

A

< div class=”panel panel-default” >
< div class=”panel-body” >Hello World < /div >
< /div >

59
Q

Add a heading to a panel with the words “My Header”.

Add a body to the same panel with the words “Hello World”

A

< div class=”panel panel-default” >
< div class=”panel-heading” > My Header < /div >
< div class=”panel-body” > Hello World < /div >
< /div >

60
Q

Add the required Bootstrap CSS classes and attributes to HTML to create a dropdown list that has a button to toggle whether the list is expanded or not.

Hint: div dropdown class with a btn dropdown-toggle on the inside before a dropdown-menu

A

< div class=”dropdown” >
< button data-toggle=”dropdown”
class=”btn btn-primary dropdown-toggle” >
Dropdown Example
< span class=”caret” >< /span >< /button >
< ul class=”dropdown-menu” >
< li >< a href=”#” >HTML< /a >< /li >
< li >< a href=”#” >CSS< /a >< /li >
< li >< a href=”#” >JavaScript< /a >< /li >
< /ul >
< /div >