CSS3图片3D翻转显示文字特效

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS3图片3D翻转显示文字特效</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: #f5f5f5;
            font-family: 'Arial', sans-serif;
            perspective: 1000px;
        }
        
        .container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 40px;
            padding: 40px;
            max-width: 1200px;
        }
        
        .flip-card {
            position: relative;
            width: 300px;
            height: 400px;
            transform-style: preserve-3d;
            transition: transform 1s;
            cursor: pointer;
        }
        
        .flip-card:hover {
            transform: rotateY(180deg);
        }
        
        .flip-card-front, 
        .flip-card-back {
            position: absolute;
            width: 100%;
            height: 100%;
            backface-visibility: hidden;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        }
        
        .flip-card-front {
            background: #333;
            display: flex;
            justify-content: center;
            align-items: center;
            color: white;
            font-size: 24px;
        }
        
        .flip-card-front img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .flip-card-back {
            background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
            transform: rotateY(180deg);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 30px;
            text-align: center;
            color: #333;
        }
        
        .flip-card-back h3 {
            font-size: 24px;
            margin-bottom: 15px;
            color: #fff;
            text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
        }
        
        .flip-card-back p {
            font-size: 16px;
            line-height: 1.6;
            margin-bottom: 20px;
            color: #fff;
        }
        
        .flip-card-back .btn {
            padding: 10px 20px;
            background: #fff;
            color: #ff9a9e;
            border: none;
            border-radius: 30px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s;
            text-decoration: none;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }
        
        .flip-card-back .btn:hover {
            background: #ff9a9e;
            color: #fff;
            transform: translateY(-3px);
            box-shadow: 0 7px 20px rgba(0, 0, 0, 0.15);
        }
        
        /* 不同卡片的不同背景色 */
        .flip-card:nth-child(2) .flip-card-back {
            background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
        }
        
        .flip-card:nth-child(2) .flip-card-back .btn {
            color: #a1c4fd;
        }
        
        .flip-card:nth-child(2) .flip-card-back .btn:hover {
            background: #a1c4fd;
            color: #fff;
        }
        
        .flip-card:nth-child(3) .flip-card-back {
            background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
        }
        
        .flip-card:nth-child(3) .flip-card-back .btn {
            color: #84fab0;
        }
        
        .flip-card:nth-child(3) .flip-card-back .btn:hover {
            background: #84fab0;
            color: #fff;
        }
        
        .title {
            position: fixed;
            top: 20px;
            color: #333;
            font-size: 28px;
            font-weight: bold;
            text-align: center;
        }
        
        .credit {
            position: fixed;
            bottom: 20px;
            color: #666;
            font-size: 14px;
        }
        
        .credit a {
            color: #ff9a9e;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div class="title">CSS3图片3D翻转显示文字特效</div>
    
    <div class="container">
        <div class="flip-card">
            <div class="flip-card-front">
                <img src="https://source.unsplash.com/random/600x800?nature" alt="Nature">
            </div>
            <div class="flip-card-back">
                <h3>自然之美</h3>
                <p>探索大自然的奥秘,感受地球最原始的魅力。从雄伟的山脉到宁静的湖泊,每一处风景都讲述着独特的故事。</p>
                <a href="#" class="btn">了解更多</a>
            </div>
        </div>
        
        <div class="flip-card">
            <div class="flip-card-front">
                <img src="https://source.unsplash.com/random/600x800?city" alt="City">
            </div>
            <div class="flip-card-back">
                <h3>城市风光</h3>
                <p>现代都市的繁华景象,人类文明的集中体现。高楼大厦、霓虹灯光,每一座城市都有它独特的节奏和故事。</p>
                <a href="#" class="btn">了解更多</a>
            </div>
        </div>
        
        <div class="flip-card">
            <div class="flip-card-front">
                <img src="https://source.unsplash.com/random/600x800?animal" alt="Animal">
            </div>
            <div class="flip-card-back">
                <h3>野生动物</h3>
                <p>地球上的奇妙生物,与我们共享这个星球。从丛林到草原,每一种动物都在生态系统中扮演着重要角色。</p>
                <a href="#" class="btn">了解更多</a>
            </div>
        </div>
    </div>
    
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值