Steam 灵感的游戏卡悬停效果

这篇具有很好参考价值的文章主要介绍了Steam 灵感的游戏卡悬停效果。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

先看效果:
Steam 灵感的游戏卡悬停效果,CSS,css,前端,javascript
再看代码(查看更多):文章来源地址https://www.toymoban.com/news/detail-652183.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Steam 灵感的游戏卡悬停效果</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: #353540;
        }

        .l-container {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            grid-gap: 30px;
            width: 100%;
            max-width: 1200px;
            padding: 30px;
        }
        @media screen and (max-width: 760px) {
            .l-container {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        .b-game-card {
            position: relative;
            z-index: 1;
            width: 100%;
            padding-bottom: 150%;
            perspective: 1000px;
        }
        .b-game-card__cover {
            position: absolute;
            z-index: 1;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%);
            background-size: cover;
            perspective-origin: 50% 50%;
            transform-style: preserve-3d;
            transform-origin: top center;
            will-change: transform;
            transform: skewX(0.001deg);
            transition: transform 0.35s ease-in-out;
        }
        .b-game-card__cover::after {
            display: block;
            content: "";
            position: absolute;
            z-index: 100;
            top: 0;
            left: 0;
            width: 100%;
            height: 120%;
            background: linear-gradient(226deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.4) 35%, rgba(255, 255, 255, 0.2) 42%, rgba(255, 255, 255, 0) 60%);
            transform: translateY(-20%);
            will-change: transform;
            transition: transform 0.65s cubic-bezier(0.18, 0.9, 0.58, 1);
        }
        .b-game-card:hover .b-game-card__cover {
            transform: rotateX(7deg) translateY(-6px);
        }
        .b-game-card:hover .b-game-card__cover::after {
            transform: translateY(0%);
        }
        .b-game-card::before {
            display: block;
            content: "";
            position: absolute;
            top: 5%;
            left: 5%;
            width: 90%;
            height: 90%;
            background: rgba(0, 0, 0, 0.5);
            box-shadow: 0 6px 12px 12px rgba(0, 0, 0, 0.4);
            will-change: opacity;
            transform-origin: top center;
            transform: skewX(0.001deg);
            transition: transform 0.35s ease-in-out, opacity 0.5s ease-in-out;
        }
        .b-game-card:hover::before {
            opacity: 0.6;
            transform: rotateX(7deg) translateY(-6px) scale(1.05);
        }
    </style>
</head>
<body>
<div class="l-container">
    <div class="b-game-card">
        <div class="b-game-card__cover" style="background-image: url(https://andrewhawkes.github.io/codepen-assets/steam-game-cards/game_1.jpg);"></div>
    </div>
    <div class="b-game-card">
        <div class="b-game-card__cover" style="background-image: url(https://andrewhawkes.github.io/codepen-assets/steam-game-cards/game_2.jpg);"></div>
    </div>
    <div class="b-game-card">
        <div class="b-game-card__cover" style="background-image: url(https://andrewhawkes.github.io/codepen-assets/steam-game-cards/game_3.jpg);"></div>
    </div>
    <div class="b-game-card">
        <div class="b-game-card__cover" style="background-image: url(https://andrewhawkes.github.io/codepen-assets/steam-game-cards/game_4.jpg);"></div>
    </div>
</div>
</body>
</html>

到了这里,关于Steam 灵感的游戏卡悬停效果的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包