Look at the HTML code below. What will you see in the browser when this page loads?
Bootsrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Test</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1 class="text-primary">Welcome to Bootstrap!</h1>
<p class="lead">This is your first Bootstrap page.</p>
</div>
</body>
</html>
AA red heading and a normal paragraph with no special styling.
BA blue heading saying 'Welcome to Bootstrap!' and a slightly larger paragraph below it.
CA plain black heading and paragraph with no Bootstrap styles applied.
DAn error message because Bootstrap CSS is missing.
Attempts:
2 left
💡 Hint
Look at the class names and the Bootstrap CSS link in the head.
✗ Incorrect
The class 'text-primary' makes the heading blue using Bootstrap's primary color. The 'lead' class makes the paragraph text larger and lighter. The Bootstrap CSS is loaded from the CDN, so styles apply correctly.
❓ selector
intermediate
1:30remaining
Which Bootstrap class adds spacing around an element?
You want to add margin space around a
using Bootstrap. Which class should you use?
Am-3
Bp-3
Ctext-center
Dbg-primary
Attempts:
2 left
💡 Hint
Bootstrap uses 'm' for margin and 'p' for padding.
✗ Incorrect
The class 'm-3' adds margin (space outside the element) on all sides. 'p-3' adds padding (space inside). 'text-center' centers text, and 'bg-primary' changes background color.
❓ layout
advanced
2:00remaining
How does Bootstrap's grid system layout behave on small screens?
Given this Bootstrap grid code, how will the columns appear on a small screen (less than 576px wide)?
Column 1
Column 2
Column 3
AAll three columns stack vertically, each taking full width.
BAll three columns appear side by side in one row, each taking one-third width.
COnly the first two columns appear side by side; the third stacks below.
DColumns disappear because 'col-sm-4' only works on medium screens.
Attempts:
2 left
💡 Hint
Bootstrap grid classes with 'sm' apply from small screens and up.
✗ Incorrect
The 'col-sm-4' class applies starting at small screens (≥576px). Below 576px, columns stack vertically and take full width by default.
❓ accessibility
advanced
1:30remaining
Which attribute improves accessibility for a Bootstrap modal?
You have a Bootstrap modal dialog. Which attribute should you add to the modal's main
to help screen readers?
Atabindex="-1"
Bdata-toggle="modal"
Crole="button"
Daria-labelledby="modalTitle"
Attempts:
2 left
💡 Hint
Screen readers need to know the modal's title for context.
✗ Incorrect
The 'aria-labelledby' attribute points to the element that labels the modal, helping screen readers announce the modal's purpose. 'data-toggle' is for JavaScript behavior, 'role="button"' is for buttons, and 'tabindex="-1"' manages focus but doesn't label.
🧠 Conceptual
expert
1:30remaining
What is the main benefit of using Bootstrap's container class?
Why do Bootstrap pages often wrap content inside a
element?
AIt disables scrolling on the page to keep content fixed.
BIt automatically adds a background color and border to the page content.
CIt centers the content and adds responsive horizontal padding to keep content aligned on all screen sizes.
DIt converts all text inside to uppercase for better readability.
Attempts:
2 left
💡 Hint
Think about how content looks on different screen sizes.
✗ Incorrect
The 'container' class centers content horizontally and adds padding on the sides. It also adjusts width responsively to keep content neat on all devices. It does not add background, disable scrolling, or change text case.
Practice
(1/5)
1. What is the main purpose of including Bootstrap CSS in your HTML page?
easy
A. To create backend server logic
B. To apply ready-made styles and layout to your webpage quickly
C. To make your page load faster by compressing images
D. To add interactive JavaScript features only
Solution
Step 1: Understand Bootstrap CSS role
Bootstrap CSS provides pre-built styles and layout helpers to style HTML elements easily.
Step 2: Differentiate CSS from JS and backend
CSS controls appearance, not backend logic or image compression, and JS adds interactivity but is separate.
Final Answer:
To apply ready-made styles and layout to your webpage quickly -> Option B
Quick Check:
Bootstrap CSS = ready styles [OK]
Hint: Bootstrap CSS styles your page fast, not backend or speed [OK]
Common Mistakes:
Confusing Bootstrap CSS with JavaScript functionality
Thinking Bootstrap compresses images
Assuming Bootstrap handles backend logic
2. Which of the following is the correct way to include Bootstrap CSS from a CDN in your HTML <head>?
easy
A.
B.
C.
D.
Solution
Step 1: Identify correct HTML tag for CSS
CSS files are included using the <link> tag with rel="stylesheet" attribute.
Step 2: Check the CDN URL and tag correctness
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> uses <link> with correct href to Bootstrap CSS CDN, others misuse tags or attributes.
Final Answer:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> -> Option C
Quick Check:
CSS uses <link rel="stylesheet"> [OK]
Hint: Use for CSS files [OK]
Common Mistakes:
Using <script> tag for CSS files
Using <style> tag with src attribute
Wrong attribute values like rel="script"
3. What will be the visual result of this HTML snippet using Bootstrap?
A. Container class should be 'container-fluid' instead
B. Button class 'btn-primary' is misspelled
C. Missing closing tag for <button>
D. Bootstrap CSS file path is likely incorrect or missing CDN link
Solution
Step 1: Check Bootstrap CSS inclusion
The link uses 'bootstrap.min.css' without a full path or CDN, which may cause the file not to load if not locally present.
Step 2: Verify other elements
Button class spelling is correct, button tag is properly closed, and 'container' is valid Bootstrap class.
Final Answer:
Bootstrap CSS file path is likely incorrect or missing CDN link -> Option D
Quick Check:
Missing or wrong CSS link breaks Bootstrap styles [OK]
Hint: Always use full CDN URL or correct local path for Bootstrap CSS [OK]
Common Mistakes:
Assuming local CSS file always exists
Confusing container and container-fluid classes
Overlooking missing or wrong file paths
5. You want to create a simple Bootstrap page with a navigation bar and a button below it. Which of the following code snippets correctly sets up the basic Bootstrap page structure including CSS and JS from CDN?