0
0
Bootsrapmarkup~5 mins

Badge component in Bootsrap - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Amarker
Blabel
Cbadge
Dtag
How do you make a Bootstrap badge have a pill shape?
AAdd class rounded-pill
BAdd class pill-badge
CAdd class badge-pill
DAdd class pill
Which class changes the badge background color to green in Bootstrap?
Abg-danger
Bbg-success
Cbg-primary
Dbg-warning
Where should you place the badge element to show a count on a button?
AInside the button element
BOutside the button element
CBefore the button element
DIn a separate div
What should you check to make badges accessible?
ABadge animation
BBadge size only
CBadge font only
DColor contrast and semantic HTML
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.