Bootstrap5 – Full Page Carousel slide zoom-in CSS effect
Bootstrap5 – Full Page Carousel slide zoom-in CSS effect
HTML
<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Hello, world!</title> <link rel="stylesheet" href="main.css"> </head> <body> <head> <div class="container-fluid bg-primary fixed-top"> <nav class="navbar navbar-expand-lg navbar-dark"> <div class="container"> <a class="navbar-brand" href="#"><img src="images/symbol_w.svg" height="24px"> <span class="fw-bolder">MeeNy</span>.com</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNavDropdown"> <ul class="navbar-nav ms-auto"> <li class="nav-item"> <a class="nav-link active" aria-current="page" href="#">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Features</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Pricing</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Dropdown link </a> <ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> <li><a class="dropdown-item" href="#">Action</a></li> <li><a class="dropdown-item" href="#">Another action</a></li> <li><a class="dropdown-item" href="#">Something else here</a></li> </ul> </li> </ul> </div> </div> </nav> </div> </head> <section> <div id="carouselExampleDark" class="carousel carousel-dark slide" data-bs-ride="carousel"> <div class="carousel-indicators"> <button type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button> <button type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="1" aria-label="Slide 2"></button> <button type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="2" aria-label="Slide 3"></button> </div> <div class="carousel-inner"> <div class="carousel-item active"> <img src="images/1.png" class="d-block" alt="..."> <div class="carousel-caption d-none d-md-block"> <h3 class="display-3 w100"><span class="w900">First</span> slide <span class="w400 text-primary">label</span></h3> <p>Some representative placeholder content for the first slide.</p> </div> </div> <div class="carousel-item"> <img src="images/2.png" class="d-block" alt="..."> <div class="carousel-caption d-none d-md-block"> <h3 class="display-3 w100"><span class="w900">Second</span> slide <span class="w400 text-secondary">label</span></h3> <p>Some representative placeholder content for the second slide.</p> </div> </div> <div class="carousel-item"> <img src="images/3.png" class="d-block" alt="..."> <div class="carousel-caption d-none d-md-block"> <h3 class="display-3 w100"><span class="w900">Third</span> slide <span class="w400 text-warning">label</span></h3> <p>Some representative placeholder content for the third slide.</p> </div> </div> </div> <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleDark" data-bs-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="visually-hidden">Previous</span> </button> <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleDark" data-bs-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="visually-hidden">Next</span> </button> </div> </section> <div class="container"> <p class="h1 fw-bold">Bold text.</p> <p class="h1 fw-bolder">Bolder weight text (relative to the parent element).</p> <p class="h1 fw-normal">Normal weight text.</p> <p class="h1 fw-light">Light weight text.</p> <p class="h1 fw-lighter">Lighter weight text (relative to the parent element).</p> <p class="h1 fst-italic">Italic text.</p> <p class="h1 fst-normal">Text with normal font style</p> <hr> <p class="h1 w100">Bold text.</p> <p class="h1 w300">Bolder weight text (relative to the parent element).</p> <p class="h1 w400">Normal weight text.</p> <p class="h1 w500">Light weight text.</p> <p class="h1 w700">Lighter weight text (relative to the parent element).</p> <p class="h1 w900">Italic text.</p> </div> <!-- Optional JavaScript; choose one of the two! --> <!-- Option 1: Bootstrap Bundle with Popper --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script> <!-- Option 2: Separate Popper and Bootstrap JS --> <!-- <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script> --> </body> </html>
SCSS
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap');
$font-family-base: "roboto", sans-serif;
$color-1 : #d8b700;
$color-2 : #7a5600;
$color-3 : #f72585;
$color-4 : #4361ee;
$color-5 : #4cc9f0;
$color-6 : #237a94;
$primary: $color-1;
$secondary: $color-2;
$success: $color-3;
$info: $color-4;
$warning: $color-5;
$danger: $color-6;;
@import "./node_modules/bootstrap/scss/bootstrap";
html,body, section, .carousel,.carousel-inner,.carousel-item{
height: 100%;
}
.carousel-inner .carousel-item > img{
width: 100%;
height: 100%;
object-fit: cover;
animation: zoomin 10s linear infinite;
}
@keyframes zoomin {
0%{
transform: scale(1);
}
50%{
transform: scale(1.05);
}
100%{
transform: scale(1);
}
}
.carousel-indicators{
button{
border-radius: 50%;
width: 10px !important;
height: 10px !important;
}
button.active {
background-color: $color-1 !important;
}
}
.carousel-caption{
top: 50%;
transform: translateY(-50%);
bottom: inherit;
}
.w100 {font-weight: 100 !important;}
.w300 {font-weight: 300 !important;}
.w400 {font-weight: 400 !important;}
.w500 {font-weight: 500 !important;}
.w700 {font-weight: 700 !important;}
.w900 {font-weight: 900 !important;}
China or America, which one do you like