CSS3 图片棋盘动画特效代码

代码如下:

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS3图片棋盘动画特效</title>
    <style>
        /* 基础样式 */
        body {
            font-family: 'Arial', sans-serif;
            background-color: #f0f2f5;
            margin: 0;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }
        
        .container {
            max-width: 1000px;
            margin: 0 auto;
            text-align: center;
        }
        
        h1 {
            color: #333;
            margin-bottom: 30px;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
        }
        
        /* 棋盘样式 */
        .chessboard {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 15px;
            perspective: 1000px;
        }
        
        .tile {
            position: relative;
            width: 100%;
            height: 180px;
            transform-style: preserve-3d;
            transition: transform 0.6s ease;
            cursor: pointer;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        
        .tile:hover {
            transform: rotateY(180deg);
        }
        
        .tile-front, .tile-back {
            position: absolute;
            width: 100%;
            height: 100%;
            backface-visibility: hidden;
            border-radius: 8px;
            overflow: hidden;
        }
        
        .tile-front img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .tile-front {
            background-color: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .tile-back {
            background: linear-gradient(135deg, #6e8efb, #a777e3);
            color: white;
            transform: rotateY(180deg);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 15px;
            box-sizing: border-box;
        }
        
        .tile-back h3 {
            margin-top: 0;
            font-size: 18px;
        }
        
        .tile-back p {
            font-size: 14px;
            margin-bottom: 10px;
        }
        
        .tile-back a {
            color: #fff;
            background-color: rgba(255,255,255,0.2);
            padding: 5px 10px;
            border-radius: 4px;
            text-decoration: none;
            transition: background-color 0.3s;
        }
        
        .tile-back a:hover {
            background-color: rgba(255,255,255,0.3);
        }
        
        /* 响应式设计 */
        @media (max-width: 768px) {
            .chessboard {
                grid-template-columns: repeat(2, 1fr);
            }
        }
        
        @media (max-width: 480px) {
            .chessboard {
                grid-template-columns: 1fr;
            }
        }
        
        /* 页脚样式 */
        .footer {
            margin-top: 40px;
            color: #666;
            font-size: 14px;
        }
        
        .footer a {
            color: #6e8efb;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>CSS3图片棋盘动画特效</h1>
        
        <div class="chessboard">
            <!-- 棋盘格子1 -->
            <div class="tile">
                <div class="tile-front">
                    <img src="https://picsum.photos/300/300?random=1" alt="示例图片1">
                </div>
                <div class="tile-back">
                    <h3>创意设计</h3>
                    <p>探索更多设计灵感</p>
                
                </div>
            </div>
            
            <!-- 棋盘格子2 -->
            <div class="tile">
                <div class="tile-front">
                    <img src="https://picsum.photos/300/300?random=2" alt="示例图片2">
                </div>
                <div class="tile-back">
                    <h3>动画效果</h3>
                    <p>CSS3强大动画功能</p>
                    <a href="#">了解更多</a>
                </div>
            </div>
            
            <!-- 棋盘格子3 -->
            <div class="tile">
                <div class="tile-front">
                    <img src="https://picsum.photos/300/300?random=3" alt="示例图片3">
                </div>
                <div class="tile-back">
                    <h3>交互体验</h3>
                    <p>增强用户参与感</p>
                    <a href="#">了解更多</a>
                </div>
            </div>
            
            <!-- 棋盘格子4 -->
            <div class="tile">
                <div class="tile-front">
                    <img src="https://picsum.photos/300/300?random=4" alt="示例图片4">
                </div>
                <div class="tile-back">
                    <h3>响应式设计</h3>
                    <p>适配各种设备</p>
                    <a href="#">了解更多</a>
                </div>
            </div>
        </div>
        
        <div class="footer">
        </div>
    </div>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值