css实现图片人物介绍卡片鼠标悬浮缩放显示文字介绍动画效果代码

代码语言:html

所属分类:悬停

代码描述:css实现图片人物介绍卡片鼠标悬浮缩放显示文字介绍动画效果代码

代码标签: css 图片 人物 介绍 卡片 鼠标 悬浮 缩放 显示 文字 介绍

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>

:root {
    --background-color: linear-gradient(to left bottom,#d87a00,#f46246,#fa557c,#e75eaf,#bc74d7,#9487eb,#6197f4,#00a3f3,#00afed,#00b9e0,#00c0cf,#2ac6bc);
    --border-color: #1a65b131;
    --text-color: #34495e;
    --color1: #EC3E27;
    --color2: #fd79a8;
    --color3: #0984e3;
    --color4: #00b894;
    --color5: #fdcb6e;
    --color6: #e056fd;
    --color7: #F97F51;
    --color8: #BDC581;
    --a_border_color: #99bacc;
    --h2_border_color: #abc;
    --a_hover_background_color: #1a65b161;
    --font_color: #e8f6fd
}

* {
    margin: 0;
    padding: 0
}

html {
    font-size: 14px
}

body {
    width: 100vw;
    height: 100vh;
    background-image: var(--background-color);
    background-size: 200%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Montserrat',sans-serif,Arial,'Microsoft Yahei';
    animation: bgAnimation 30s linear infinite
}

@keyframes bgAnimation {
    0% {
        background-position: 0 50%
    }

    50% {
        background-position: 100% 50%
    }

    100% {
        background-position: 0 50%
    }
}

.card {
    flex-shrink: 0;
    flex-grow: 0;
    position: relative;
    width: 300px;
    height: 450px;
    overflow: hidden;
    margin: 20px;
    background-color: var(--border-color);
    border-radius: 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
    box-shadow: 0 0 30px #2c2c2c;
    color: var(--font_color)
}

.photo {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    border-radius: 0;
    overflow: hidden;
    transition: .5s
}

.photo::before {
    position: absolute;
    content: '';
    width: 100%;
    height: 100%;
    background-image: linear-gradient(to top,#292929e9,transparent)
}

.card:hover .photo::before {
    display: none
}

.photo img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.card:hover .photo {
    width: 120px;
    height: 120px;
    top: 30px;
    border-radius: 50%;
    box-shadow: 0 0 20px #111.........完整代码请登录后点击上方下载按钮下载查看

网友评论0