Step 1:Create css file like style.css
@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;1,100;1,300&family=Slabo+27px&display=swap"); *::after, *::before { box-sizing: border-box; } body { margin: 0; padding: 0; font-family: "Roboto", sans-serif; font-style: normal; } a, a:hover, a:focus, a:active, a:link { outline: none; text-decoration: none; color: #000; } .bs-card { position: relative; padding: 100px 0; display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap; } .bs-card .card { position: relative; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; justify-content: space-between; align-items: center; min-width: 350px; max-width: 350px; height: 250px; background-color: #fff; background-clip: border-box; box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.2); border-radius: 0; border: 0; overflow: hidden; -webkit-transition: all 0.4s ease; -moz-transition: all 0.4s ease; -o-transition: all 0.4s ease; transition: all 0.4s ease; margin: 25px 0; } .bs-card .card:hover { height: 450px; } .bs-card .card .card-img { position: absolute; top: 0; left: 0; right: 0; bottom: 0; transition: all 0.6s ease; display: flex; justify-content: space-evenly; flex-direction: column; align-items: center; background: #fff; border-radius: 0; height: 250px; z-index: 2; } .bs-card .card:hover .card-img img { border-color: #e13e0cd6; } .bs-card .card .card-img img { width: 200px; height: 200px; border-radius: 50%; box-shadow: 0 0 13px 0 #9d9d9d; border: 10px solid #e13e0c5c; } .bs-card .card .card-body { position: absolute; bottom: 0; left: 0; right: 0; height: 200px; padding: 16px; background: #000; } .bs-card .card .card-title { position: relative; margin-bottom: 10px; } .bs-card .card .card-title::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; width: 100px; height: 2px; background: #fff; margin: auto; } .bs-card .card .card-title h5 { text-transform: uppercase; font-weight: 500; letter-spacing: 0.5px; text-align: center; color: #fff; } .bs-card .card .card-body .card-description p { text-align: center; font-weight: 300; color: #fff; } .bs-card .card .card-body .card-btn { text-align: center; margin-top: 15px; } .bs-card .card .card-body .card-btn a.bs-btn:focus { outline: 0 !important; outline-offset: 0; } .bs-card .card .card-body .card-btn a.bs-btn { position: relative; display: inline-block; min-width: 170px; max-width: 170px; padding: 10px 0; background: no-repeat; text-transform: uppercase; font-weight: 500; font-size: 14px; letter-spacing: 1px; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; border: 3px solid #e13e0cd6; border-radius: 40px; cursor: pointer; color: #e13e0cd6; z-index: 1; margin-bottom: 15px; } .bs-card .card .card-body .card-btn a.bs-btn:after { content: ""; position: absolute; z-index: -1; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; transition: all 0.3s; } .bs-card .card .card-body .card-btn a.bs-btn.btn-hover { overflow: hidden; } .bs-card .card .card-body .card-btn a.bs-btn.btn-hover:after { width: 101%; height: 0; top: 50%; left: 50%; background: #e13e0cd6; opacity: 0; -webkit-transform: translateX(-50%) translateY(-50%); -moz-transform: translateX(-50%) translateY(-50%); -ms-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%); } .bs-card .card .card-body .card-btn a.bs-btn.btn-hover:hover, .bs-card .card .card-body .card-btn a.bs-btn.btn-hover:active { color: #fff; } .bs-card .card .card-body .card-btn a.bs-btn.btn-hover:hover:after { height: 75%; opacity: 1; } .bs-card .card .card-body .card-btn a.bs-btn.btn-hover:active:after { height: 130%; opacity: 1; } @media (max-width: 320px) { .bs-card .card .card-body .card-description p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; } } @media (max-width: 375px) { .bs-card .card { min-width: 100%; max-width: 100%; } }
<!DOCTYPE html> <html lang="en"> <head> <!-- Required meta tags --> <title>card hover</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="css/style.css" /> </head> <body> <!-- container --> <div class="container"> <section class="bs-card"> <div class="card"> <div class="card-img"> <img src="images/card/image-1.jpg" alt="Not images" /> </div> <div class="card-body"> <div class="card-title"> <h5>card hover effect</h5> </div> <div class="card-description"> <p>Lorem ipsum dolor sit adipisicing incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam.</p> </div> <div class="card-btn"> <a href="#" class="bs-btn btn-hover">hover </a> </div> </div> </div> <div class="card"> <div class="card-img"> <img src="images/card/image-3.jpg" alt="Not images" /> </div> <div class="card-body"> <div class="card-title"> <h5>card hover effect</h5> </div> <div class="card-description"> <p>Lorem ipsum dolor sit adipisicing incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam.</p> </div> <div class="card-btn"> <a href="#" class="bs-btn btn-hover">hover </a> </div> </div> </div> <div class="card"> <div class="card-img"> <img src="images/card/image-4.jpg" alt="Not images" /> </div> <div class="card-body"> <div class="card-title"> <h5>card hover effect</h5> </div> <div class="card-description"> <p>Lorem ipsum dolor sit adipisicing incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam.</p> </div> <div class="card-btn"> <a href="#" class="bs-btn btn-hover">hover </a> </div> </div> </div> </section> </div> <!-- container end --> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> </body> </html>