Challenge - 5 Problems
Bootstrap Card Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate1:30remaining
What will this Bootstrap card display?
Look at the Bootstrap card code below. What text will appear inside the card header?
Bootsrap
<div class="card" style="width: 18rem;"> <div class="card-header"> Featured </div> <div class="card-body"> <h5 class="card-title">Special title treatment</h5> <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> </div> <div class="card-footer text-muted"> 2 days ago </div> </div>
Attempts:
2 left
💡 Hint
The card header text is inside the div with class 'card-header'.
✗ Incorrect
The text inside the div with class 'card-header' is 'Featured'. This is the header section of the card.
🧠 Conceptual
intermediate1:00remaining
Which Bootstrap class defines the card footer?
In Bootstrap, which class should you use to create the footer section of a card?
Attempts:
2 left
💡 Hint
Look for the class that starts with 'card-' and ends with 'footer'.
✗ Incorrect
The correct class for the footer section of a Bootstrap card is 'card-footer'.
❓ selector
advanced1:30remaining
Which CSS selector targets only the card body text?
Given this HTML structure for a Bootstrap card, which CSS selector will select only the paragraph inside the card body?
Bootsrap
<div class="card"> <div class="card-header">Header</div> <div class="card-body"> <p class="card-text">Body text here</p> </div> <div class="card-footer">Footer</div> </div>
Attempts:
2 left
💡 Hint
The paragraph is a direct child of the card-body div.
✗ Incorrect
The selector '.card-body > p' selects only paragraphs that are direct children of elements with class 'card-body'. This matches the paragraph inside the card body only.
❓ layout
advanced1:30remaining
How to vertically center card footer text using Flexbox?
You want the text inside the card footer to be vertically centered. Which CSS style will achieve this using Flexbox?
Bootsrap
<div class="card-footer">Footer text</div>
Attempts:
2 left
💡 Hint
Flexbox aligns items vertically with 'align-items'.
✗ Incorrect
Using 'display: flex' and 'align-items: center' vertically centers the content inside the container.
❓ accessibility
expert2:00remaining
Which ARIA role best describes a Bootstrap card component?
For accessibility, which ARIA role is most appropriate to assign to a Bootstrap card element that groups related content?
Bootsrap
<div class="card" role="?"> <div class="card-header">Header</div> <div class="card-body">Body content</div> <div class="card-footer">Footer</div> </div>
Attempts:
2 left
💡 Hint
The card is a self-contained piece of content that can stand alone.
✗ Incorrect
The 'article' role is used for self-contained content that could be independently distributed or reused, which fits a card component.