大神,JS的图片遮罩效果怎么做

大神,JS的图片遮罩效果怎么做,第1张

遮罩层的CSS #mask { position: fixedleft: 0right: 0top: 0bottom: 0background: rgba(0, 0, 0, .3)z-index: 99999}在传统浏览器中,不支持rgba的写法。

ie下面高版本的渐变又透明的才行。没法透明,可以考虑使用透明png。

rgba最后面的那个1可以改为0.8试试看,就变成透明的了。。

#box{width:200pxheight:200pxoverflow:hiddenposition: relative}

#box span{

display: blockwidth:100%height:100%position: absolutetop:0left:0

background-image:linear-gradient(bottom, rgba(0,0,0,1) 0%,rgba(255,255,255,1) 100%)

background-image:-o-linear-gradient(bottom, rgba(0,0,0,1) 0%,rgba(255,255,255,1) 100%)

background-image:-moz-linear-gradient(bottom, rgba(0,0,0,1) 0%,rgba(255,255,255,1) 100%)

background-image:-webkit-linear-gradient(bottom, rgba(0,0,0,1) 0%,rgba(255,255,255,1) 100%)

background-image:-ms-linear-gradient(bottom, rgba(0,0,0,1) 0%,rgba(255,255,255,1) 100%)

filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#000000,endColorstr=#ffffff,grandientType=1)

}

<div id="box">

<img src="https://ss3.baidu.com/-fo3dSag_xI4khGko9WTAnF6hhy/news/q=100/sign=2c88d7ac67d0f703e0b291dc38fb5148/3bf33a87e950352a60c7a4b35643fbf2b3118be3.jpg">

<span></span>

</div>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11805240.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存