杰网资源 Design By www.escxy.com

话不多,看效果先:

html+css实现响应式卡片悬停效果

卡片悬停,响应式卡片,简约效果。

实现:

1. 定义标签,.kapian为最底层盒子,然后两个子盒子一个放图片,一个放文本:

 

<div class="kapian">
          <div class="tu">
             <img src="3.2.png">
          </div>
          <div class="wenben">
                <h2>The aurora borealis</h2>
                <p style="padding-bottom: 20px;">natural</p>
                <p>
                    Aurora Borealis is a colorful luminous phenomenon that appears over the high magnetic latitude region of the planet's North Pole. 
                    I love the aurora borealis. It's so beautiful.
                    </p>
          </div>
    </div>

2.先定义底层盒子的css基本样式,长宽等,就不详细说明了:

 

 .kapian{
            position: relative;
            width: 300px;
            height: 400px;
            border-radius: 3px;
            background-color: #fff;
            box-shadow: 2px 3px 3px rgb(139, 138, 138);
            overflow: hidden;
            cursor: pointer;
            transition: all 0.3s;
        }
        .kapian:hover{
            box-shadow: 2px 3px 10px rgb(36, 35, 35);
        }

:hover鼠标经过后盒子阴影变化。
transition: all 0.3s;过渡效果,阴影在0.3s内慢慢变化

3. 图片的基本样式,采用绝对定位:

 

.tu{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 300px;
            overflow: hidden;
            
        }
        .tu img{
            width: 100%;
            height: 100%;
            transition: all 0.5s;
        }
        .kapian:hover .tu img{
            transform: scale(1.2);
            filter: blur(1px);
        }

:hover鼠标经过后图片变大,而且变模糊;
transform: scale(1.2);图片变大为1.2倍;
filter: blur(1px);图片变模糊;

4 .定义装文本这个盒子的基本样式,采用绝对定位:

 

.wenben{
            position: absolute;
            bottom: -200px;
            width: 100%;
            height: 300px;
            background-color: rgb(247, 242, 242);
            transition: 0.5s;
        }
        .kapian:hover .wenben{
            bottom: 0px;
        }

:hover鼠标经过后文本框绝对定位的bottom发生改变,使得呈现文本框向上展开的效果;

5 .文本框里字符的样式:

.wenben h2{
            color: rgb(21, 74, 172);
            line-height: 60px;
            text-align: center;

        }
        .wenben p{
            padding: 0 30px;
            font-family: 'fangsong';
            font-size: 16px;
            font-weight: bold;
            line-height: 20px;
            text-align: center;
        }

完整代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body{
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
           background-image: radial-gradient(rgb(241, 238, 238),black);
        }
        .kapian{
            position: relative;
            width: 300px;
            height: 400px;
            border-radius: 3px;
            background-color: #fff;
            box-shadow: 2px 3px 3px rgb(139, 138, 138);
            overflow: hidden;
            cursor: pointer;
            transition: all 0.3s;
        }
        .kapian:hover{
            box-shadow: 2px 3px 10px rgb(36, 35, 35);
        }
        .tu{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 300px;
            overflow: hidden;
            
        }
        .tu img{
            width: 100%;
            height: 100%;
            transition: all 0.5s;
        }
        .kapian:hover .tu img{
            transform: scale(1.2);
            filter: blur(1px);
        }
        .wenben{
            position: absolute;
            bottom: -200px;
            width: 100%;
            height: 300px;

            background-color: rgb(247, 242, 242);
            transition: 0.5s;
        }
        .kapian:hover .wenben{
            bottom: 0px;
        }
        .wenben h2{
            color: rgb(21, 74, 172);
            line-height: 60px;
            text-align: center;

        }
        .wenben p{
            padding: 0 30px;
            font-family: 'fangsong';
            font-size: 16px;
            font-weight: bold;
            line-height: 20px;
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="kapian">
          <div class="tu">
             <img src="3.2.png">
          </div>
          <div class="wenben">
                <h2>The aurora borealis</h2>
                <p style="padding-bottom: 20px;">natural</p>
                <p>
                    Aurora Borealis is a colorful luminous phenomenon that appears over the high magnetic latitude region of the planet's North Pole. 
                    I love the aurora borealis. It's so beautiful.
                    </p>
          </div>
    </div>
</body>
</html>

总结:

希望在路上~

html+css实现响应式卡片悬停效果

标签:
html,css卡片悬停,响应式卡片悬停

杰网资源 Design By www.escxy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
杰网资源 Design By www.escxy.com

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。