纯css实现卡片悬浮切换效果

代码语言:html

所属分类:选项卡

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

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

    <title>CSS Card Hover Effects | Html &amp; CSS - From: Online Tutorials</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            min-height: 100vh;
            background: #333;
            display: flex;
            justify-content: center;
            align-items: center;
            font-family: 'Courier New', Courier, monospace;
        }

        .bloco-geral {
            width: 90%;
            position: relative;
            display: flex;
            justify-content: space-between;
        }

        .bloco-geral .cartao {
            position: relative;

        }
        .bloco-geral .cartao .face {
            width: 300px;
            height: 300px;
            transition: 0.5s;
        }

        .bloco-geral .cartao .face.face1 {
            position: relative;
            background: green;
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1;
            transform: translateY(150px);

        }

        .bloco-geral .cartao:hover .face.face1 {
            transform: translateY(0px);
            background: #ff0057;
        }

        .bloco-geral .cartao .face.face1 .conteudo {
            opacity: 0.2;
            transition: 0.5s;

        }

        .bloco-geral .cartao:hover .face.face1 .conteudo {
            opacity: 1;

        }

        .bloco-geral .cartao .face.face1 .conteudo h3 {
            margin: 10px 0 0;
            padding: 0;
            color: #fff;
            text-align: center;
            font-size: 1.5em;
        }

        .bloco-geral .cartao .face.face2 {
            position: relative;
            background: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            box-sizing: border-box;
            box-shadow: 0 20px 50px rgba(0,0,0,0.8);
            transform: translateY(-150px);
        }

        .bloco-geral .cartao:hover .face.face2 {
            transform: translateY(0);
        }

        .bloco-geral .cartao .face.face2 .conteudo p {
            margin: 0;
            padding: 20px;
        }

        .bloco-geral .cartao .face.face2 .conteudo a {
            margin: 15px 0 0;
            display: inline-block;
            text-decoration: none;
            font-weight: 900;
            color: black;
            padding: 5px;
            border: 1px solid black;
        }

        .bloco-geral .cartao .face.face2 .conteudo a:hover {
            background: #333;
            color: #fff;
        }
    </style>

</head>
<body translate="no">
    <!DOCTYPE html>
    <html lang="en">
    <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">
        <link rel="stylesheet" href="galeria.css">
        <title>Document</title>
    </head>
    <body>
        <div class="bloco-geral">
            <div class="cartao">
                <div class="face face1">
                    <div class="conteudo">
         .........完整代码请登录后点击上方下载按钮下载查看

网友评论0