Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

Effect:HTML code:

<! DOCTYPEhtml>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="Width = device - width, initial - scale = 1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./index.css">
</head>
<body>
    <div class="container">
        <div class="card">
            <span></span>
            <span></span>
            <span></span>
            <span></span>
            <div class="content">
                <h2>01</h2>
                <h3>Post Title</h3>
                <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi nulla dolore impedit! Officia minima enim asperiores aliquid, tempore in corrupti.</p>
                <a href="#">Read More</a>
            </div>
        </div>
        <div class="card">
            <span></span>
            <span></span>
            <span></span>
            <span></span>
            <div class="content">
                <h2>02</h2>
                <h3>Post Title</h3>
                <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi nulla dolore impedit! Officia minima enim asperiores aliquid, tempore in corrupti.</p>
                <a href="#">Read More</a>
            </div>
        </div>
        <div class="card">
            <span></span>
            <span></span>
            <span></span>
            <span></span>
            <div class="content">
                <h2>03</h2>
                <h3>Post Title</h3>
                <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi nulla dolore impedit! Officia minima enim asperiores aliquid, tempore in corrupti.</p>
                <a href="#">Read More</a>
            </div>
        </div>
    </div>
</body>
</html>
Copy the code

The CSS code:

* {margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins',sans-serif;
}
body{
    display: flex;
    justify-content: center;
    align-items: center;
    background: #08001b;
    min-height: 100vh;
}
.container{
    width: 1100px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}
.container .card{
    position: relative;
    width: 300px;
    height: 400px;
    background: #0c002b;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px;
    box-shadow: 0 20px 50px rgba(0.0.0.0.2);
    overflow: hidden;
}
.container:hover .card{
    opacity: 0.2;
}
.container .card:hover{
    opacity: 1;
}
.container .card::before{
    content: ' ';
    position: absolute;
    top: 2px;
    left: 2px;
    bottom: 2px;
    background: rgba(255.255.255.0.1);
    pointer-events: none;
}
.container .card .content{
    padding: 30px;
    text-align: center;
}
.container .card .content h2{
    position: absolute;
    font-size: 4em;
    font-weight: 800;
    color: #1779ff;
    z-index: 1;
    opacity: 0.1;
    transform: 0.5 s;
}
.container .card:hover .content h2{
    opacity: 1;
    transform: translateY(-70px);
}
.container .card .content h3{
    position: relative;
    font-size: 1.5 em;
    /* font-weight: 800; * /
    color: #fff;
    z-index: 2;
    opacity: 0.5;
    transform: 0.5 s;
    letter-spacing: 1px;
} 
.container .card .content p{
    position: relative;
    font-size: 1em;
    font-weight: 300;
    color: #fff;
    z-index: 2;
    opacity: 0.5;
    transform: 0.5 s;
    letter-spacing: 1px;
} 
.container .card:hover .content p..container .card:hover .content h3{
    opacity: 1;
    /* transform: translateY(-70px); * /
}
.container .card .content a{
    display: inline-block;
    margin-top: 15px;
    padding: 8px 15px;
    background: #fff;
    color: #0c002b;
    text-decoration: none;
    text-transform: uppercase;
    font-weight: 600;
}
.container .card span{
    transition: 0.5;
    opacity: 0;
}
.container .card:hover span{
    / * the transition: 0.5; * /
    opacity: 1;
}
.container .card span:nth-child(1) {position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right,transparent,#1779ff);
    animation: animate1 2s linear infinite;
}
@keyframes animate1{
    0%
    {
        transform: translateX(-100%);
    }
    100%{
    transform: translateX(100%); }}.container .card span:nth-child(2) {position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom,transparent,#1779ff);
    animation: animate2 2s linear infinite;
    animation-delay: 1s;
}
@keyframes animate2{
    0%
    {
        transform: translateY(-100%);
    }
    100%{
    transform: translateY(100%); }}.container .card span:nth-child(3) {position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to left,transparent,#1779ff);
    animation: animate3 2s linear infinite;
}
@keyframes animate3{
    0%
    {
        transform: translateX(100%);
    }
    100%{
    transform: translateX(-100%); }}.container .card span:nth-child(4) {position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to top,transparent,#1779ff);
    animation: animate4 2s linear infinite;
    animation-delay: 1s;
}
@keyframes animate4{
    0%
    {
        transform: translateY(100%);
    }
    100%{
    transform: translateY(-100%); }}Copy the code