How To Make Animation Profile Card Using CSS And Bootstrap Part-6

admin_img Posted By Bajarangi soft , Posted On 28-01-2021

We made an Animated Profile Card with Hover Animation using HTML CSS. here we created animation hover effect inside the image with contents and animated icons.

How To Make Animation Profile Card Using CSS And Bootstrap Part-6

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;
    min-width: 350px;
    max-width: 350px;
    height: 400px;
    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 {
    transform: translateY(-5px) scale(1.005) translateZ(0);
}

.bs-card .card:hover .card-overlay::before {
    transform: scale(1);
    opacity: 1;
}

.bs-card .card .card-overlay::before {
    content: "";
    position: absolute;
    top: 20px;
    left: 20px;
    bottom: 20px;
    right: 20px;
    border: 1px solid #fff;
    z-index: 2;
    pointer-events: none;
    transition: transform 0.2s linear, opacity 0.2s linear;
    transform: scale(0.7);
    opacity: 0;
}

.bs-card .card:hover .card-overlay::after {
    content: " ";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-color:#3700f3;
    opacity: 0.2;
    transition: opacity 0.2s linear;
}

.bs-card .card .card-img {
    width: 100%;
    border-radius: calc(0.25rem - 1px);
}
.bs-card .card .card-img img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.bs-card .card .card-body {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 1;
    transform: translateY(75px);
    transition: transform 0.2s 0.2s linear;
}

.bs-card .card:hover .card-body {
    transform: translateY(0);
}

.bs-card .card .card-body .card-title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin-bottom: 10px;
    text-align: center;
}

.bs-card .card .card-body .card-title h5 {
    text-transform: uppercase;
    font-weight: 400;
    color: #ffff;
}
.bs-card .card:hover .card-body .card-title h5 {
    font-weight: 600;
}

.bs-card .card:hover .card-body .card-description {
    opacity: 1;
    transform: translateY(0);
    transition: transform 1s linear;
}

.bs-card .card .card-body .card-description {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.2s 0.2s linear;
}

.bs-card .card .card-body .card-description p {
    font-weight: 400;
    font-size: 14px;
    text-align: center;
    color: #fff;
}

.bs-card .card .card-body .card-share ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bs-card .card .card-body .card-share ul li {
    display: inline-block;
    color: #fff;
}

.bs-card .card .card-body .card-flex {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
}

.bs-card .card .card-body .card-flex .card-share ul li a i {
    width: 40px;
    height: 40px;
    line-height: 40px;
    font-size: 20px;
    color: #fff;
}

.bs-card .card .card-body .card-flex .card-share {
    text-align: center;
}

.bs-card .card .card-body .card-flex .card-share {
    transition: transform 0.2s linear, opacity 0.2s linear;
    opacity: 0;
}
.bs-card .card .card-body .card-flex .card-share:first-child {
    transform: translateX(-20px);
    margin-left: 40px;
}

.bs-card .card .card-body .card-flex .card-share:last-child {
    transform: translateX(20px);
    margin-right: 40px;
}
.bs-card .card:hover .card-body .card-flex .card-share {
    transform: translateX(0);
    opacity: 1;
    transition: transform 0.2s 0.4s linear, opacity 0.2s 0.4s linear;
}

@media (max-width: 340px) {
    .bs-card .card .card-body .card-flex .card-share:first-child {
        margin-left: 0;
    }
    .bs-card .card .card-body .card-flex .card-share:last-child {
        margin-right: 0;
    }
}

@media (max-width: 375px) {
    .bs-card .card {
        min-width: 100%;
        max-width: 100%;
    }
}

Step 2:Create html file like index.html and import style.css in it.
 
<!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-overlay">
                <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 amet consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam.</p>
                    </div>
                    <div class="card-flex">
                        <div class="card-share">
                            <ul>
                                <li>
                                    <a href="#"><i class="fa fa-heart"></i></a> like
                                </li>
                            </ul>
                        </div>
                        <div class="card-share">
                            <ul>
                                <li>
                                    <a href="#"><i class="fa fa-share-alt"></i></a> share
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="card">
            <div class="card-overlay">
                <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 amet consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam.</p>
                    </div>
                    <div class="card-flex">
                        <div class="card-share">
                            <ul>
                                <li>
                                    <a href="#"><i class="fa fa-heart"></i></a> like
                                </li>
                            </ul>
                        </div>
                        <div class="card-share">
                            <ul>
                                <li>
                                    <a href="#"><i class="fa fa-share-alt"></i></a> share
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="card">
            <div class="card-overlay">
                <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 amet consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam.</p>
                    </div>
                    <div class="card-flex">
                        <div class="card-share">
                            <ul>
                                <li>
                                    <a href="#"><i class="fa fa-heart"></i></a> like
                                </li>
                            </ul>
                        </div>
                        <div class="card-share">
                            <ul>
                                <li>
                                    <a href="#"><i class="fa fa-share-alt"></i></a> share
                                </li>
                            </ul>
                        </div>
                    </div>
                </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>

Related Post