html 图片过渡色,CSS3的颜色(RGBA)透明度、渐变颜色、图片、旋转和过渡

背景透明度:

opacity:0~1( 每次变换0.1)

#color{width:200px;height:200px;background-color:blue;opacity:1;/*透明度*/

效果如下:

opacity:1时

f857b043153acdde5e4d9db8a6cbd64b.png

opacity:0.5时

d17eb84274db61d6655d1dc86dbade55.png

opacity:0时

d1ae0b743200c1665d349ab1140abf2a.png

背景颜色:

RGBA

R:红 G:绿 B:蓝 alpha:透明度的参数

RGB的取值范围是0~255/0~100% alpha的取值范围是0~1 不可为负值

#color{width:200px;height:200px;background-color:rgba(0,0,0,0.5);

}

效果如下:

d8120ae663f745c9f34aa1bdda2cbb54.png

渐变颜色:

background-image: linear-gradient(to bottom,#fff,red);  备注一下{linear-gradient 线性渐变}

参数说明:第一个参数指定渐变方向 to top,to bottom,to right,to left,to top left......

第二和第三个参数:是指定开始与结束的颜色值 可以有多个颜色background-image: linear-gradient(to bottom,#fff,black,red);

#color{width:200px;height:200px;background-image:linear-gradient(to right,red,blue);

}

效果如下:

070ed0338a323b57edad684795133b2c.png

图片:

1图片圆角与盒子圆角类似 border-radius

#tupian{width:300px;height:400px;

}#tupian img{border-radius:50%; /*图片圆角*/

}

效果如下:

251d24dc3a2eae030735414dc070a237.png

2图片响应式:  max-width: 100%;height: auto;

#tupian{width:300px;height:400px;

}#tupian img{

max-width: 100%;

height: auto;

}

效果如下:

f50856312c882ecc74e83714b28b8318.png

889de3ce6be277f4ded202e759e31198.png

图片滤镜:

filter:  备注{ 灰色效果为例}

模糊效果

.blur {

-webkit-filter: blur(4px);

filter: blur(4px);

}

高亮效果

.brightness {

-webkit-filter: brightness(0.30);

filter: brightness(0.30);

}

对比度

.contrast {

-webkit-filter: contrast(180%);

filter: contrast(180%);

}

灰色图像

.grayscale {

-webkit-filter: grayscale(100%);

filter: grayscale(100%);

}

色相旋转

.huerotate {

-webkit-filter: hue-rotate(180deg);

filter: hue-rotate(180deg);

}

反转输入图像

.invert {

-webkit-filter: invert(100%);

filter: invert(100%);

}

透明度

.opacity {

-webkit-filter: opacity(50%);

filter: opacity(50%);

}

饱和度

.saturate {

-webkit-filter: saturate(7);

filter: saturate(7);

}

深褐色

.sepia {

-webkit-filter: sepia(100%);

filter: sepia(100%);

}

阴影效果

.shadow {

-webkit-filter: drop-shadow(8px 8px 10px green);

filter: drop-shadow(8px 8px 10px green);

}

#tupian{width:300px;height:400px;

}#tupian img{filter:grayscale(100%);

}

效果如下:

bb34a9d400388284a59c3ceea5ffaf7a.png

旋转和过渡:transform  transition

1rotate( deg)

#tupian img:hover{transform:rotate(30deg);/*旋转*/

}#tupian img{filter:grayscale(100%);transition:5s;

}

效果如下:

b08e341e425ab92419889fd7481454fd.png

translate:( px,  px)

#tupian img:hover{transform:translate(30px,50px);

}

scale:(1.2)

#tupian img:hover{transform:scale(1.2);

}

效果如下:

5932c8ebb320f47e304b3630e06c82a4.png

skew:

#tupian img:hover{transform:skew(30deg,10deg);

}

效果如下:

66c96dc690d3b52dd1bb325a79a43ce7.png

rotateX:(30deg)  备注 rotateY:( deg) 类似

#tupian img:hover{transform:rotateX(30deg);/*沿X轴翻转*/

}

效果如下:

4a7024406fc394dec661296f130f8f0f.png

d569fbce2b91895a557123886d5bc9ea.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值