Bootstrap is a popular CSS framework that helps you quickly design and customize responsive websites with ready-to-use styles and components.
Click to reveal answer
beginner
How can you include Bootstrap in your project using a CDN?
You add a <link> tag in the <head> of your HTML that points to Bootstrap's CSS file hosted online. For example: <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
Click to reveal answer
beginner
What is the advantage of using Bootstrap via CDN?
Using a CDN means you don't have to download Bootstrap files yourself. The files load fast from servers worldwide, and if a visitor already has the files cached from another site, your site loads even faster.
Click to reveal answer
beginner
How do you import Bootstrap JavaScript functionality?
You add a <script> tag before the closing </body> tag that links to Bootstrap's JavaScript bundle. For example: <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
Click to reveal answer
intermediate
What is a common way to install Bootstrap for local development?
You can use a package manager like npm by running <code>npm install bootstrap</code>. Then you import Bootstrap CSS and JS files into your project files to customize or bundle them.
Click to reveal answer
Which HTML tag is used to include Bootstrap CSS from a CDN?
A<link>
B<script>
C<style>
D<import>
✗ Incorrect
Bootstrap CSS is included using the <link> tag inside the <head> section.
Where should you place the Bootstrap JavaScript <script> tag in your HTML?
AInside the <head> tag
BAt the very top of the HTML file
CInside a <style> tag
DBefore the closing </body> tag
✗ Incorrect
Placing JavaScript before the closing </body> tag helps the page load faster and ensures HTML is loaded first.
What is one benefit of using Bootstrap via CDN?
AYou must download files manually
BFiles load slower from your server
CVisitors may already have files cached
DYou cannot customize Bootstrap
✗ Incorrect
CDNs allow browsers to reuse cached files from other sites, speeding up load times.
Which command installs Bootstrap locally using npm?
Anpm install bootstrap
Bnpm get bootstrap
Cnpm add bootstrap
Dnpm download bootstrap
✗ Incorrect
The correct npm command to install Bootstrap is 'npm install bootstrap'.
To use Bootstrap's JavaScript components, which file do you include?
Abootstrap.min.css
Bbootstrap.bundle.min.js
Cbootstrap.js
Dbootstrap.min.css.map
✗ Incorrect
The 'bootstrap.bundle.min.js' file includes Bootstrap's JavaScript and its dependencies.
Explain how to add Bootstrap to a simple HTML project using a CDN.
Think about where CSS and JS files go in HTML.
You got /3 concepts.
Describe the difference between importing Bootstrap via CDN and installing it locally.
Consider speed, control, and customization.
You got /4 concepts.
Practice
(1/5)
1. What is the correct way to include Bootstrap CSS in your HTML project?
easy
A. Use a <link> tag inside the <head> section
B. Use a <script> tag inside the <head> section
C. Use a <style> tag inside the <body> section
D. Use a <script> tag before the closing </html> tag
Solution
Step 1: Understand where CSS files go
CSS files are linked in the <head> section to load styles before the page shows.
Step 2: Use the correct HTML tag for CSS
The <link> tag is used to include external CSS files like Bootstrap.
Final Answer:
Use a <link> tag inside the <head> section -> Option A
Quick Check:
Bootstrap CSS = <link> in <head> [OK]
Hint: CSS files always use <link> in <head> [OK]
Common Mistakes:
Using <script> tag for CSS
Placing CSS link in <body>
Not including Bootstrap CSS at all
2. Which of the following is the correct syntax to add Bootstrap JavaScript in your HTML file?
easy
A. <script src="bootstrap.bundle.min.js"></script>
B. <script href="bootstrap.bundle.min.js"></script>
C. <script src="bootstrap.min.css"></script>
D. <link rel="stylesheet" href="bootstrap.bundle.min.js">
Solution
Step 1: Identify the correct tag for JavaScript
JavaScript files are included with the <script> tag using the src attribute.
Step 2: Check the file name and attribute
The correct file is bootstrap.bundle.min.js and it must be linked with src, not href.
Final Answer:
<script src="bootstrap.bundle.min.js"></script> -> Option A
Quick Check:
Bootstrap JS uses <script src="..."> [OK]
Hint: JavaScript files use
Common Mistakes:
Using href instead of src for scripts
Linking CSS file with <script>
Using <link> tag for JavaScript
3. Given this HTML snippet, what will be the visual result in the browser?
The <link> tag includes Bootstrap CSS from CDN, so styles apply.
Step 2: Understand Bootstrap button classes
The classes btn btn-primary style the button with Bootstrap's primary blue color.
Final Answer:
A blue styled button labeled 'Click Me' -> Option D
Quick Check:
Bootstrap button with btn-primary = blue button [OK]
Hint: btn-primary class makes button blue [OK]
Common Mistakes:
Ignoring the Bootstrap CSS link
Confusing btn-primary with btn-danger
Expecting default browser button style
4. You added Bootstrap JavaScript with this tag: <script href="bootstrap.bundle.min.js"></script> Why does Bootstrap's interactive features not work?
medium
A. Because Bootstrap JavaScript needs no script tag
B. Because the href attribute is incorrect for scripts
C. Because JavaScript must be added in the <head> section
D. Because the file name is wrong
Solution
Step 1: Identify correct attribute for script source
The <script> tag uses src to link files, not href.
Step 2: Understand effect of wrong attribute
Using href means the browser does not load the JavaScript file, so features fail.
Final Answer:
Because the href attribute is incorrect for scripts -> Option B
Quick Check:
Script files use src, not href [OK]
Hint: Scripts need src attribute, not href [OK]
Common Mistakes:
Using href instead of src in <script>
Placing script in wrong HTML section
Assuming JavaScript loads without script tag
5. You want to create a responsive webpage using Bootstrap. Which is the best way to import Bootstrap to ensure both styles and interactive components work properly?
hard
A. Add Bootstrap JS only with <script> in <head>, CSS is optional
B. Add Bootstrap CSS and JS both inside <head> using <link> tags
C. Add Bootstrap CSS with <link> in <head> and Bootstrap JS with <script src="..."></script> before </body>
D. Add Bootstrap CSS with <style> tag and JS with <script href="..."> before </body>
Solution
Step 1: Correctly include Bootstrap CSS
Bootstrap CSS must be linked with <link> in the <head> for styles to load early.
Step 2: Correctly include Bootstrap JavaScript
Bootstrap JS should be added with <script src="..."></script> before closing </body> for proper loading and performance.
Final Answer:
Add Bootstrap CSS with <link> in <head> and JS with <script src="..."> before </body> -> Option C
Quick Check:
CSS in head + JS before body end = proper Bootstrap import [OK]
Hint: CSS in head, JS before for Bootstrap [OK]
Common Mistakes:
Placing JS in head with wrong attributes
Skipping CSS link tag
Using href instead of src for JS
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.