Challenge - 5 Problems
Carousel Caption Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate1:30remaining
What is the visible caption text on the first slide?
Given this Bootstrap carousel code snippet, what caption text will appear on the first slide when the page loads?
Bootsrap
<div id="carouselExampleCaptions" class="carousel slide" data-bs-ride="carousel"> <div class="carousel-inner"> <div class="carousel-item active"> <img src="slide1.jpg" class="d-block w-100" alt="Slide 1"> <div class="carousel-caption d-none d-md-block"> <h5>Welcome to Nature</h5> <p>Experience the beauty of the outdoors.</p> </div> </div> <div class="carousel-item"> <img src="slide2.jpg" class="d-block w-100" alt="Slide 2"> <div class="carousel-caption d-none d-md-block"> <h5>Adventure Awaits</h5> <p>Find your next journey here.</p> </div> </div> </div> </div>
Attempts:
2 left
💡 Hint
Look for the caption inside the first
carousel-item active block.✗ Incorrect
The first slide is marked with the class
active. Its caption heading is inside h5 with text 'Welcome to Nature'.❓ selector
intermediate1:30remaining
Which CSS selector targets all carousel captions visible on medium and larger screens?
In Bootstrap 5, which CSS selector correctly selects all carousel captions that are visible only on medium (md) and larger screen sizes?
Attempts:
2 left
💡 Hint
Remember Bootstrap's display utility classes:
d-none hides, d-md-block shows from medium screens up.✗ Incorrect
The class
d-none hides the element by default, and d-md-block makes it visible as block starting at medium screen size.🧠 Conceptual
advanced1:30remaining
Why use
aria-label on carousel captions?What is the main reason to add
aria-label attributes to carousel caption elements in Bootstrap?Attempts:
2 left
💡 Hint
Think about users who rely on assistive technologies.
✗ Incorrect
The
aria-label attribute provides descriptive text for screen readers, helping visually impaired users understand the caption content.📝 Syntax
advanced1:30remaining
What error occurs with this incorrect caption markup?
What error or issue will occur if the
carousel-caption div is placed outside the carousel-item div in Bootstrap?Bootsrap
<div id="carouselExample" class="carousel slide" data-bs-ride="carousel"> <div class="carousel-inner"> <div class="carousel-item active"> <img src="slide1.jpg" class="d-block w-100" alt="Slide 1"> </div> <div class="carousel-caption d-none d-md-block"> <h5>Caption Outside</h5> <p>This caption is misplaced.</p> </div> </div> </div>
Attempts:
2 left
💡 Hint
Consider how Bootstrap associates captions with slides.
✗ Incorrect
Captions must be inside each
carousel-item to show with that slide. Outside placement means no caption is linked to any slide, so it won't display.❓ layout
expert2:00remaining
How to vertically center carousel captions with Flexbox?
You want carousel captions to be vertically centered over the image in Bootstrap 5. Which CSS snippet correctly applies Flexbox to achieve this inside
.carousel-caption?Attempts:
2 left
💡 Hint
Flexbox with
justify-content: center centers content vertically in a column layout.✗ Incorrect
Setting
display: flex and flex-direction: column makes the caption a vertical flex container. justify-content: center centers the content vertically inside the full height.