Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a list group item with a badge showing the number 14.
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">[1]</span> </li> </ul>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting class names inside the badge content instead of the number.
Leaving the badge span empty.
✗ Incorrect
The badge content should be the number 14 to display the count inside the badge.
2fill in blank
mediumComplete the code to add the correct Bootstrap class to the badge for a green background.
Bootsrap
<ul class="list-group"> <li class="list-group-item d-flex justify-content-between align-items-center"> Notifications <span class="badge [1] rounded-pill">5</span> </li> </ul>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bg-danger' which is red instead of green.
Forgetting to add any background color class.
✗ Incorrect
The class 'bg-success' gives the badge a green background color in Bootstrap.
3fill in blank
hardFix the error in the code by choosing the correct class to make the list group item and badge align horizontally.
Bootsrap
<ul class="list-group"> <li class="list-group-item [1] justify-content-between align-items-center"> Tasks <span class="badge bg-secondary rounded-pill">7</span> </li> </ul>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'd-block' which stacks items vertically.
Using 'd-inline' which does not create a flex container.
✗ Incorrect
The 'd-flex' class makes the list group item a flex container, aligning content horizontally.
4fill in blank
hardFill both blanks to create a list group with two items, each having a badge with different colors.
Bootsrap
<ul class="list-group"> <li class="list-group-item [1] justify-content-between align-items-center"> Messages <span class="badge [2] rounded-pill">12</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> Alerts <span class="badge bg-danger rounded-pill">3</span> </li> </ul>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'd-block' which stacks content vertically.
Using wrong badge color classes.
✗ Incorrect
The list item needs 'd-flex' to align content horizontally, and the badge uses 'bg-primary' for a blue background.
5fill in blank
hardFill all three blanks to create a list group with three items, each with badges showing counts and different colors.
Bootsrap
<ul class="list-group"> <li class="list-group-item [1] justify-content-between align-items-center"> Inbox <span class="badge [2] rounded-pill">8</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> Updates <span class="badge bg-warning rounded-pill">4</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> Spam <span class="badge [3] rounded-pill">1</span> </li> </ul>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting 'd-flex' on the first list item.
Mixing badge color classes.
✗ Incorrect
The first list item uses 'd-flex' for horizontal layout, the first badge uses 'bg-info' for a light blue color, and the last badge uses 'bg-danger' for red.