Performance: Carousel captions
This affects page load speed and interaction responsiveness by adding DOM elements and CSS styles for captions in carousels.
<div class="carousel-caption d-none d-md-block"> <h5>Slide Title</h5> <p>Slide description with simple fade using opacity only.</p> </div>
<div class="carousel-caption d-none d-md-block"> <h5 class="animated fadeInDown">Slide Title</h5> <p class="animated fadeInUp">Slide description with heavy CSS animations.</p> </div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Heavy animated captions | Adds multiple nodes with animation classes | Multiple reflows per animation frame | High paint cost due to layout thrashing | [X] Bad |
| Simple static captions | Adds minimal nodes without animations | Single reflow on load | Low paint cost with no layout shifts | [OK] Good |
carousel-caption class in a Bootstrap carousel?carousel-caption class is used inside each carousel-item to add text overlays on slides.<div class='carousel-caption'> inside each carousel-item.<caption> is for tables, carousel-text is not a Bootstrap class, and span is less common and outside the item is incorrect.<div class='carousel-caption text-start'>Caption</div>
text-start aligns text to the left side in Bootstrap.carousel-caption contains text-start, the caption text will appear left aligned on the slide.<div class='carousel-caption text-center'>Welcome</div>
carousel-caption to be inside a carousel-item for it to show properly.text-center does not hide text, captions must be inside carousel-inner, and div is the correct tag.text-start for left alignment, second uses text-center for center, and third uses text-end for right alignment.carousel-item with correct alignment classes matching the requirement.Pass the test and this pattern moves unknown