动态头像
lix_uan 83 2

效果图

3 4

HTML

<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>头像动效</title>
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <div class="main">
            <div class="item">
                <div class="info">
                    <h3>use what you have</h3>
                    <p>power by Lix_uan
                        <a href="#">View More</a>
                    </p>
                </div>
            </div>
        </div>
    </body>
</html>

CSS

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

body,
html {
    width: 100%;
    height: 100%;
}

body {
    background: #fff;
}

.main {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.item {
    width: 180px;
    height: 180px;
    background: url(1.jpg) no-repeat;
    border-radius: 50%;
    box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, .1);
    position: relative;
    transition: all .4s ease-in-out;
}

.info {
    opacity: 0;
    transform: scale(0);
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(63, 147, 147, .8);
    border-radius: 50%;
    text-align: center;
    transition: all .4s ease-in-out;
}

.info h3 {
    height: 115px;
    font-size: 18px;
    color: #fff;
    margin: 0, 30px;
    padding-top: 45px;
    text-transform: uppercase;
}

.info p {
    opacity: 0;
    font-size: 12px;
    color: #fff;
    margin: 0 30px;
    font-style: italic;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, .5);
    transition: all .4s ease-in-out .4s;
}

.info a {
    display: block;
    color: #fff;
    font-style: normal;
}

.item:hover {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), 0 1px 2px rgba(0, 0, 0, .1);
}

.item:hover .info {
    opacity: 1;
    transform: scale(1);
}

.item:hover .info p {
    opacity: 1;
}
预览图
评论区

索引目录