0
0
Bootsrapmarkup~20 mins

List group with badges in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Bootstrap Badge Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
Rendering a Bootstrap list group with badges
What will be the visual output of this Bootstrap list group code snippet?
Bootsrap
<ul class="list-group">
  <li class="list-group-item d-flex justify-content-between align-items-center">
    Messages
    <span class="badge bg-primary rounded-pill">14</span>
  </li>
  <li class="list-group-item d-flex justify-content-between align-items-center">
    Notifications
    <span class="badge bg-secondary rounded-pill">2</span>
  </li>
</ul>
AA vertical list with two items: 'Messages' with a blue pill-shaped badge showing '14' on the right, and 'Notifications' with a gray pill-shaped badge showing '2' on the right.
BA horizontal list with two items: 'Messages' and 'Notifications' each with badges below the text.
CA vertical list with two items: 'Messages' and 'Notifications' but badges appear on the left side of the text.
DA vertical list with two items but badges are square and appear inside the text.
Attempts:
2 left
💡 Hint
Look at the classes used for layout and badge styling.
selector
intermediate
1:30remaining
CSS selector for badge styling in Bootstrap list groups
Which CSS selector correctly targets the badge elements inside a Bootstrap list group item?
A.badge > .list-group-item
B.badge .list-group-item
C.list-group .badge-item
D.list-group-item > .badge
Attempts:
2 left
💡 Hint
Think about the badge being a direct child of the list group item.
🧠 Conceptual
advanced
2:00remaining
Accessibility considerations for badges in list groups
Which practice improves accessibility for badges in Bootstrap list groups?
AUse only color to indicate badge importance without text or labels.
BHide badges from screen readers using aria-hidden="true" always.
CAdd aria-label to the badge describing its meaning, e.g., aria-label="14 unread messages".
DPlace badges outside the list group items to avoid confusion.
Attempts:
2 left
💡 Hint
Think about users who rely on screen readers.
layout
advanced
2:00remaining
Effect of removing flex classes on badge alignment
What happens if you remove the 'd-flex justify-content-between align-items-center' classes from the list group item containing a badge?
Bootsrap
<ul class="list-group">
  <li class="list-group-item">
    Messages
    <span class="badge bg-primary rounded-pill">14</span>
  </li>
</ul>
AThe badge appears immediately after the text without spacing and is vertically aligned baseline, not on the right side.
BThe badge moves to the right side with space between text and badge.
CThe badge appears below the text, centered horizontally.
DThe badge disappears completely from the list item.
Attempts:
2 left
💡 Hint
Consider how flexbox controls horizontal spacing and alignment.
📝 Syntax
expert
2:30remaining
Correct Bootstrap badge class for a pill-shaped badge
Which option uses the correct Bootstrap 5 class combination to create a pill-shaped badge with a green background inside a list group item?
A<span class="badge badge-success pill-rounded">New</span>
B<span class="badge bg-success rounded-pill">New</span>
C<span class="badge bg-green rounded-pill">New</span>
D<span class="badge bg-success rounded-circle">New</span>
Attempts:
2 left
💡 Hint
Check Bootstrap 5 badge color and shape classes.