图像半透明



是否可以使图像半透明?我的意思是这样的background:linear-gradient(to bottom,rgb(44, 44, 44),rgb(29, 38, 51,0.322));

有一个可用的webkit解决方案,如以下示例所示。更多信息请点击此处 https://css-tricks.com/clipping-masking-css/

img {
width: 150px;
-webkit-mask-image: -webkit-gradient(linear, left top, right bottom,color-stop(0.00,  rgba(0,0,0,1)),color-stop(0.35,  rgba(0,0,0,1)),color-stop(0.50,  rgba(0,0,0,0)),color-stop(0.65,  rgba(0,0,0,0)),color-stop(1.00,  rgba(0,0,0,0)));
}
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/Harry-Potter-1-.jpg" alt="" />

最新更新