Bird
Raised Fist0
Bootsrapmarkup~20 mins

Spinner components in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Spinner Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate
2:00remaining
What is the visual output of this spinner code?
Look at the following Bootstrap spinner code. What will you see on the webpage?
Bootsrap
<div class="spinner-border text-primary" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
AA spinning square with visible text 'Loading...'
BA blue circular spinner rotating with hidden text for screen readers
CA static blue circle with visible text 'Loading...'
DNo spinner visible, only the text 'Loading...' shown
Attempts:
2 left
💡 Hint
Remember that 'spinner-border' creates a rotating circle and 'visually-hidden' hides text visually but keeps it for screen readers.
📝 Syntax
intermediate
2:00remaining
Which option correctly creates a growing spinner in Bootstrap?
Bootstrap has two spinner types: border and growing. Which code snippet correctly creates a growing spinner?
A
&lt;div class="spinner-grow text-success" role="status"&gt;
  &lt;span class="visually-hidden"&gt;Loading...&lt;/span&gt;
&lt;/div&gt;
B
&lt;div class="spinner-border-grow text-success" role="status"&gt;
  &lt;span class="visually-hidden"&gt;Loading...&lt;/span&gt;
&lt;/div&gt;
C
&lt;div class="spinner-grow text-success" aria-hidden="true"&gt;
  Loading...
&lt;/div&gt;
D
&lt;div class="spinner-grow-border text-success" role="status"&gt;
  &lt;span class="visually-hidden"&gt;Loading...&lt;/span&gt;
&lt;/div&gt;
Attempts:
2 left
💡 Hint
The correct class for a growing spinner is 'spinner-grow'.
❓ accessibility
advanced
2:00remaining
What accessibility role should a spinner have for screen readers?
You want to make sure your spinner is accessible. Which ARIA role is correct to use on a spinner element?
Arole="alert"
Brole="presentation"
Crole="progressbar"
Drole="status"
Attempts:
2 left
💡 Hint
The spinner indicates loading status but does not show progress percentage.
❓ layout
advanced
2:00remaining
How to center a Bootstrap spinner horizontally and vertically in a full viewport?
You want to place a spinner exactly in the center of the screen both horizontally and vertically. Which CSS approach works best with Bootstrap classes?
AWrap spinner in a div with 'position-absolute top-50 start-50' and no transform
BUse 'text-center' on the spinner and set margin-top: 50vh in CSS
CUse a container with classes 'd-flex justify-content-center align-items-center vh-100' wrapping the spinner
DUse 'mx-auto my-auto' on spinner with fixed width and height
Attempts:
2 left
💡 Hint
Flexbox utilities in Bootstrap can center content easily.
🧠 Conceptual
expert
3:00remaining
Which spinner type is better for unknown loading duration and why?
Bootstrap offers 'spinner-border' and 'spinner-grow'. Which spinner type is more suitable when the loading time is unknown and why?
A'spinner-border' because its continuous rotation visually indicates ongoing activity without implying progress
B'spinner-grow' because its expanding animation suggests progress completion over time
C'spinner-border' because it uses less CPU and battery on devices
D'spinner-grow' because it is more accessible for screen readers
Attempts:
2 left
💡 Hint
Think about what the animation communicates to users about loading.

Practice

(1/5)
1. What is the main purpose of Bootstrap spinner components?
easy
A. To show a loading or processing state visually
B. To create navigation menus
C. To style buttons with colors
D. To add images to the page

Solution

  1. Step 1: Understand spinner usage

    Spinners are used to indicate that something is loading or processing in the background.
  2. Step 2: Identify spinner purpose in Bootstrap

    Bootstrap spinner components visually show this loading state to users.
  3. Final Answer:

    To show a loading or processing state visually -> Option A
  4. Quick Check:

    Spinner = Loading indicator [OK]
Hint: Spinners always mean loading or waiting [OK]
Common Mistakes:
  • Thinking spinners are for decoration only
  • Confusing spinners with buttons
  • Using spinners for static images
2. Which of the following is the correct Bootstrap class to create a border spinner?
easy
A. spinner-grow
B. spinner-spin
C. spinner-border
D. spinner-circle

Solution

  1. Step 1: Recall Bootstrap spinner classes

    Bootstrap provides two main spinner classes: spinner-border and spinner-grow.
  2. Step 2: Identify the border spinner class

    The class spinner-border creates a spinner with a border style.
  3. Final Answer:

    spinner-border -> Option C
  4. Quick Check:

    Border spinner class = spinner-border [OK]
Hint: Border spinner always uses spinner-border class [OK]
Common Mistakes:
  • Using spinner-grow for border spinner
  • Typing class names incorrectly
  • Confusing spinner classes with button classes
3. What will be the visible result of this code snippet?
<div class="spinner-grow text-primary" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
medium
A. A growing spinner with blue color and hidden accessible text
B. A border spinner with red color and visible text
C. A static blue circle with visible 'Loading...' text
D. No spinner shown, only text visible

Solution

  1. Step 1: Analyze spinner-grow and text-primary classes

    The spinner-grow class creates a growing spinner animation. The text-primary class applies Bootstrap's primary blue color.
  2. Step 2: Understand role and visually-hidden span

    The role="status" helps screen readers. The span with visually-hidden hides the text visually but keeps it accessible.
  3. Final Answer:

    A growing spinner with blue color and hidden accessible text -> Option A
  4. Quick Check:

    spinner-grow + text-primary = blue growing spinner [OK]
Hint: spinner-grow + text-primary = blue growing spinner [OK]
Common Mistakes:
  • Thinking text-primary changes text color only
  • Expecting visible text from visually-hidden span
  • Confusing spinner-grow with spinner-border
4. Identify the error in this spinner code:
<div class="spinner-border" aria-label="Loading">
  <span>Loading...</span>
</div>
medium
A. aria-label should be aria-labelledby
B. Incorrect class name spinner-border
C. Missing role="status" attribute for accessibility
D. Span should have class visually-hidden for screen readers

Solution

  1. Step 1: Check accessibility best practices for spinners

    Bootstrap recommends adding a span with visually-hidden class inside spinners to provide accessible text for screen readers.
  2. Step 2: Analyze given code

    The span inside the spinner lacks the visually-hidden class, so the text is visible visually, which is not ideal.
  3. Final Answer:

    Span should have class visually-hidden for screen readers -> Option D
  4. Quick Check:

    Accessible text inside spinner needs visually-hidden class [OK]
Hint: Use visually-hidden class on spinner text for accessibility [OK]
Common Mistakes:
  • Omitting visually-hidden class
  • Using aria-label instead of role
  • Confusing aria-label with aria-labelledby
5. You want to create a spinner that grows in size and uses the Bootstrap danger color with accessible text. Which code snippet correctly achieves this?
hard
A.
Loading...
B.
Loading...
C.
Loading...
D.
Loading...

Solution

  1. Step 1: Choose spinner-grow for growing animation

    The question asks for a spinner that grows in size, so spinner-grow is the correct class.
  2. Step 2: Apply danger color and accessibility

    The text-danger class applies the red color. The role="status" and span with visually-hidden provide accessible loading text.
  3. Step 3: Verify all requirements

    Loading... uses spinner-grow, text-danger, role="status", and hidden accessible text correctly.
  4. Final Answer:

    <div class="spinner-grow text-danger" role="status"><span class="visually-hidden">Loading...</span></div> -> Option B
  5. Quick Check:

    Growing spinner + danger color + accessible text =
    Loading...
    [OK]
Hint: spinner-grow + text-danger + visually-hidden span = correct combo [OK]
Common Mistakes:
  • Using spinner-border instead of spinner-grow
  • Missing role="status"
  • Not hiding accessible text visually
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard