Recall & Review
beginner
What is a Bootstrap badge component used for?
A Bootstrap badge is a small count or label that helps highlight new or unread items, status, or counts next to text or icons.
Click to reveal answer
beginner
How do you add a badge to a button in Bootstrap?
You add a
<span> with class badge inside the button element. For example: <br><button class='btn btn-primary'>Inbox <span class='badge bg-secondary'>4</span></button>Click to reveal answer
beginner
What class do you use to change the color of a Bootstrap badge?Use background utility classes like
bg-primary, bg-success, bg-danger, etc., on the badge element to change its color.Click to reveal answer
beginner
How can you make a badge appear as a pill shape in Bootstrap?
Add the class
rounded-pill to the badge element to make it have rounded edges like a pill.Click to reveal answer
intermediate
What accessibility feature should you consider when using badges?
Ensure badges have sufficient color contrast and use semantic HTML so screen readers can understand the badge content. Also, use
aria-label if the badge content is not clear alone.Click to reveal answer
Which class is required to create a badge in Bootstrap?
✗ Incorrect
The class
badge is used to create badge components in Bootstrap.How do you make a Bootstrap badge have a pill shape?
✗ Incorrect
The class
rounded-pill makes badges pill-shaped in Bootstrap.Which class changes the badge background color to green in Bootstrap?
✗ Incorrect
bg-success applies a green background color to badges.Where should you place the badge element to show a count on a button?
✗ Incorrect
The badge
<span> should be inside the button element to appear attached.What should you check to make badges accessible?
✗ Incorrect
Good color contrast and semantic HTML help badges be accessible to all users.
Explain how to create a badge in Bootstrap and customize its color and shape.
Think about the classes you add to a <span> element inside buttons or text.
You got /3 concepts.
Describe why accessibility matters for badges and how to improve it.
Consider users who rely on screen readers or have vision difficulties.
You got /3 concepts.