Challenge - 5 Problems
Card Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate2:00remaining
What is the visual output of this Bootstrap card group code?
Given the following HTML code using Bootstrap 4, what will the cards look like when rendered in a modern browser?
<div class="card-group">
<div class="card">
<img src="img1.jpg" class="card-img-top" alt="Image 1">
<div class="card-body">
<h5 class="card-title">Card 1</h5>
<p class="card-text">Text 1</p>
</div>
</div>
<div class="card">
<img src="img2.jpg" class="card-img-top" alt="Image 2">
<div class="card-body">
<h5 class="card-title">Card 2</h5>
<p class="card-text">Text 2</p>
</div>
</div>
<div class="card">
<img src="img3.jpg" class="card-img-top" alt="Image 3">
<div class="card-body">
<h5 class="card-title">Card 3</h5>
<p class="card-text">Text 3</p>
</div>
</div>
</div>Bootsrap
<div class="card-group"> <div class="card"> <img src="img1.jpg" class="card-img-top" alt="Image 1"> <div class="card-body"> <h5 class="card-title">Card 1</h5> <p class="card-text">Text 1</p> </div> </div> <div class="card"> <img src="img2.jpg" class="card-img-top" alt="Image 2"> <div class="card-body"> <h5 class="card-title">Card 2</h5> <p class="card-text">Text 2</p> </div> </div> <div class="card"> <img src="img3.jpg" class="card-img-top" alt="Image 3"> <div class="card-body"> <h5 class="card-title">Card 3</h5> <p class="card-text">Text 3</p> </div> </div> </div>
Attempts:
2 left
💡 Hint
Think about how Bootstrap's card-group arranges cards in a row with equal height.
✗ Incorrect
Bootstrap's card-group arranges cards side by side in a horizontal row. It ensures all cards have equal height and aligns images at the top horizontally. This creates a neat, uniform look for multiple cards.
🧠 Conceptual
intermediate1:30remaining
Which Bootstrap class creates a deck of cards with equal width and spacing?
You want to create a set of cards that automatically adjust their width to fill the container evenly with consistent spacing. Which Bootstrap class should you use?
Attempts:
2 left
💡 Hint
This class was designed to create equal width cards with spacing between them.
✗ Incorrect
The card-deck class arranges cards with equal width and spacing, making them look like a deck of cards. card-group aligns cards side by side but does not add spacing. card-columns creates a Pinterest-like masonry layout. card-container is not a Bootstrap class.
❓ selector
advanced2:00remaining
Which CSS selector targets only the card titles inside a Bootstrap card deck?
Given a Bootstrap card deck with multiple cards, which CSS selector will style only the card titles inside the deck?
Bootsrap
<div class="card-deck"> <div class="card"> <div class="card-body"> <h5 class="card-title">Title 1</h5> </div> </div> <div class="card"> <div class="card-body"> <h5 class="card-title">Title 2</h5> </div> </div> </div>
Attempts:
2 left
💡 Hint
Think about selecting elements inside the card deck container.
✗ Incorrect
The selector '.card-deck .card-title' selects all elements with class 'card-title' inside any descendant of '.card-deck'. This correctly targets all card titles inside the deck. Option D selects card titles inside any card anywhere, not limited to the deck. Option D looks for direct children with class 'card-title' which do not exist. Option D selects card titles inside any card-body, regardless of deck.
❓ layout
advanced2:00remaining
What happens if you put cards inside a Bootstrap card-columns container?
You use the following code:
How will the cards be arranged visually?
<div class="card-columns"> <div class="card">Card 1 content</div> <div class="card">Card 2 content</div> <div class="card">Card 3 content</div> </div>
How will the cards be arranged visually?
Bootsrap
<div class="card-columns"> <div class="card">Card 1 content</div> <div class="card">Card 2 content</div> <div class="card">Card 3 content</div> </div>
Attempts:
2 left
💡 Hint
This container creates a Pinterest-style layout.
✗ Incorrect
The card-columns class arranges cards in a masonry-like column layout where cards flow vertically in columns with varying heights. This creates a staggered effect similar to Pinterest. It is different from card-group or card-deck which arrange cards horizontally.
❓ accessibility
expert2:30remaining
Which ARIA attribute improves accessibility for a Bootstrap card group?
You want to make a Bootstrap card group more accessible for screen readers. Which ARIA attribute is best to add to the card group container?
Bootsrap
<div class="card-group"> <!-- multiple cards here --> </div>
Attempts:
2 left
💡 Hint
Think about describing the group meaningfully to assistive technologies.
✗ Incorrect
Adding aria-label with a descriptive text like 'Group of related cards' helps screen readers understand the purpose of the card group. role="list" is not appropriate because cards are not list items. aria-hidden="true" hides content from screen readers, which is not desired. role="presentation" removes semantic meaning, which reduces accessibility.