vanilla-tilt实现视觉差异卡片交互悬浮效果代码

代码语言:html

所属分类:视觉差异

代码描述:vanilla-tilt实现视觉差异卡片交互悬浮效果代码

代码标签: vanilla-tilt 视觉 差异 卡片 交互 悬浮

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

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');
    
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: 'Poppins', sans-serif;
    }
    
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        background-image: url('//repo.bfw.wiki/bfwrepo/image/656b2c1d29965.png');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        margin: 0;
    }
    
    .container {
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        width: 100%;
        transform-style: preserve-3d;
    }
    
    .container .box {
        position: relative;
        width: 300px;
        height: 400px;
        margin: 40px;
        background: rgba(246, 244, 244, 0.2);
        border-radius: 20px;
        transform-style: preserve-3d;
    }
    
    .container .box .name {
        position: absolute;
        top: 0;
        left: 0;
        text-align: center;
        width: 100%;
        transform-style: preserve-3d;
        transform: translate3d(0,0,75px);
        color: #fff;
        opacity: 0;
        z-index: 10;
        transition: 0.5s;
    }
    
    .container .box:hover .name {
      top: 40px;
      opacity: 1;
    }
    
   .........完整代码请登录后点击上方下载按钮下载查看

网友评论0