透明遮罩层鼠标滑过效果-2(div+css)

1.代码:
<!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">
    <title>遮罩层划过效果</title>
</head>
<style type="text/css">
    body,p,dl,dd,ul,ol,li,div,h1,h2,h3,h4,h5,h6,form,input,table,tr,td{
        padding: 0;
        margin: 0;
    }
    .box{
        width:200px;
        height:150px;
        margin:30px;
        position: relative;
        top:0;
        left:0; 
        overflow:hidden;
    }
    .imgclass{
        display: block;
    }
    .bdDiv{
        width:200px;
        height:150px;
        background: gray;
        position: absolute;
        top:150px;
        left:0;
        opacity: 0.5;/*透明度设置(0-1),低版本浏览器不支持此属性*/
        filter:alpha(opacity=50);/*此时取值为0到100*/
        transition: all .6s; 
    }
    .word{
        width:200px;
        height: 40px;
        background: #00b7ee;
        color:white;
        font-size: 16px;
        line-height: 40px;
        text-indent: 30px;
        text-decoration: none;/*去掉下划线*/
        position: absolute;
        bottom:-40px;
        left:0;
        transition: all .6s; 
    }
     .box:hover .bdDiv{
        top:0px;
    }
    .box:hover .word{
        bottom:0px;
    } 
</style>
<body>
    <div class="box">
        <img class="imgclass" src="img/1.jpg"/>
        <div class="bdDiv"></div>
        <a class="word" href="#">这本书真尼玛好看!</a>
    </div>
</body>
</html>
2.结果展示:

在这里插入图片描述

3.备注:

利用transition属性实现渐变动画效果。

欢迎关注我的公众号。
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

遥感与地理信息

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值