Bootstrap 4 캐러셀
캐러셀(회전식 슬라이드쇼)은 요소를 순환하는 슬라이드쇼다.
캐러셀을 만드는 방법
예제
<div id="demo" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ul class="carousel-indicators"> <li data-target="#demo" data-slide-to="0" class="active"></li> <li data-target="#demo" data-slide-to="1"></li> <li data-target="#demo" data-slide-to="2"></li> </ul> <!-- The slideshow --> <div class="carousel-inner"> <div class="carousel-item active"> <img src="la.jpg" alt="Los Angeles"> </div> <div class="carousel-item"> <img src="chicago.jpg" alt="Chicago"> </div> <div class="carousel-item"> <img src="ny.jpg" alt="New York"> </div> </div> <!-- Left and right controls --> <a class="carousel-control-prev" href="#demo" data-slide="prev"> <span class="carousel-control-prev-icon"></span> </a> <a class="carousel-control-next" href="#demo" data-slide="next"> <span class="carousel-control-next-icon"></span> </a> </div>
기본 예시
예제 보기슬라이드에 캡션 추가
각 슬라이드에 캡션을 만들려면 <div class=”carousel-item”> 각 내부에 <div class=”carousel-caption”> 요소를 추가한다.
예제
<div class="carousel-item"> <img src="la.jpg" alt="Los Angeles"> <div class="carousel-caption"> <h3>Los Angeles</h3> <p>We had such a great time in LA!</p> </div> </div>
기본 예시
예제 보기참고
W3C School - Bootstrap – Bootstrap 4 Carousel