Bootstrap 4 carousel hero full page with animated caption.
A Pen by FrankieDoodie on CodePen.
Bootstrap 4 carousel hero full page with animated caption.
A Pen by FrankieDoodie on CodePen.
| <div id="carousel" class="carousel slide hero-slides" data-ride="carousel"> | |
| <ol class="carousel-indicators"> | |
| <li class="active" data-target="#carousel" data-slide-to="0"></li> | |
| <li data-target="#carousel" data-slide-to="1"></li> | |
| <li data-target="#carousel" data-slide-to="2"></li> | |
| </ol> | |
| <div class="carousel-inner" role="listbox"> | |
| <div class="carousel-item active boat"> | |
| <div class="container h-100 d-none d-md-block"> | |
| <div class="row align-items-center h-100"> | |
| <div class="col-12 col-md-9 col-lg-7 col-xl-6"> | |
| <div class="caption animated fadeIn"> | |
| <h2 class="animated fadeInLeft">Boat Excursions</h2> | |
| <p class="animated fadeInRight">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras tristique nisl vitae luctus sollicitudin. Fusce consectetur sem eget dui tristique, ac posuere arcu varius.</p> | |
| <a class="animated fadeInUp btn delicious-btn" href="#">Learn more</a> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="carousel-item sea"> | |
| <div class="container h-100 d-none d-md-block"> | |
| <div class="row align-items-center h-100"> | |
| <div class="col-12 col-md-9 col-lg-7 col-xl-6"> | |
| <div class="caption animated fadeIn"> | |
| <h2 class="animated fadeInLeft">Discover the canyon by the sea</h2> | |
| <p class="animated fadeInRight">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras tristique nisl vitae luctus sollicitudin. Fusce consectetur sem eget dui tristique, ac posuere arcu varius.</p> | |
| <a class="animated fadeInUp btn delicious-btn" href="#">Learn more</a> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="carousel-item river"> | |
| <div class="container h-100 d-none d-md-block"> | |
| <div class="row align-items-center h-100"> | |
| <div class="col-12 col-md-9 col-lg-7 col-xl-6"> | |
| <div class="caption animated fadeIn"> | |
| <h2 class="animated fadeInLeft">Explore the river valley</h2> | |
| <p class="animated fadeInRight">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras tristique nisl vitae luctus sollicitudin. Fusce consectetur sem eget dui tristique, ac posuere arcu varius.</p> | |
| <a class="animated fadeInUp btn delicious-btn" href="#">Learn more</a> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <a class="carousel-control-prev" href="#carousel" role="button" data-slide="prev"> | |
| <span class="carousel-control-prev-icon" aria-hidden="true"></span> | |
| <span class="sr-only">Previous</span> | |
| </a> | |
| <a class="carousel-control-next" href="#carousel" role="button" data-slide="next"> | |
| <span class="carousel-control-next-icon" aria-hidden="true"></span> | |
| <span class="sr-only">Next</span> | |
| </a> | |
| </div> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/animateCSS/1.2.2/jquery.animatecss.min.js"></script> |
| #carousel .carousel-item.boat { | |
| background-image: url("https://picsum.photos/1200/600/?image=1083"); | |
| } | |
| #carousel .carousel-item.sea { | |
| background-image: url("https://picsum.photos/1200/600/?image=1050"); | |
| } | |
| #carousel .carousel-item.river { | |
| background-image: url("https://picsum.photos/1200/600/?image=1015"); | |
| } | |
| #carousel .carousel-item { | |
| height: 100vh; | |
| width: 100%; | |
| min-height: 350px; | |
| background: no-repeat center center scroll; | |
| background-size: cover; | |
| } | |
| #carousel .carousel-inner .carousel-item { | |
| transition: -webkit-transform 2s ease; | |
| transition: transform 2s ease; | |
| transition: transform 2s ease, -webkit-transform 2s ease; | |
| } | |
| #carousel .carousel-item .caption { | |
| background-color: rgba(0, 0, 0, 0.5); | |
| padding: 40px; | |
| color: white; | |
| animation-duration: 1s; | |
| animation-delay: 2s; | |
| } | |
| #carousel .caption h2 { | |
| animation-duration: 1s; | |
| animation-delay: 2s; | |
| } | |
| #carousel .caption p { | |
| animation-duration: 1s; | |
| animation-delay: 2.2s; | |
| } | |
| #carousel .caption a { | |
| animation-duration: 1s; | |
| animation-delay: 2.4s; | |
| } | |
| /* Button */ | |
| .delicious-btn { | |
| display: inline-block; | |
| min-width: 160px; | |
| height: 60px; | |
| color: #ffffff; | |
| border: none; | |
| border-left: 3px solid #1c8314; | |
| border-radius: 0; | |
| padding: 0 30px; | |
| font-size: 16px; | |
| line-height: 58px; | |
| font-weight: 600; | |
| -webkit-transition-duration: 500ms; | |
| transition-duration: 500ms; | |
| text-transform: capitalize; | |
| background-color: #40ba37; | |
| } | |
| .delicious-btn.active, .delicious-btn:hover, .delicious-btn:focus { | |
| font-size: 16px; | |
| font-weight: 600; | |
| color: #ffffff; | |
| background-color: #1c8314; | |
| border-color: #40ba37; | |
| } |
| <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" /> | |
| <link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css" rel="stylesheet" /> |