倒影(-webkit-box-reflect)

通过html5的-webkit-box-reflect来做倒影,代码如下:

box-reflect属性值有:dirrection-方向:above向上,below向下,left向左,right向右。

offset距离:可以是数值,也可以是百分比:

mask-box-image设置倒影的遮罩图像:(1)url(2)linear-gradient线性渐变创建遮罩图像。(3)repeating-linear-gradient重复线性渐变创建遮罩图像。(4)repeating-url重复径向径向渐变创建遮罩图像。

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>倒影</title>
	<style>
		.box{
			width: 500px;
			height: 260px;
			text-align: center;
			margin: 0 auto;
			background: url(2.jpg) center center /cover no-repeat;
			-webkit-box-reflect: below 16px -webkit-linear-gradient(transparent,transparent 50%,rgba(255,255,255,0.6));
		}
	</style>
</head>
<body>
	<div class="box"></div>
</body>
</html>

最终效果展示见下图: 

 

猜你喜欢

转载自blog.csdn.net/zhangqling/article/details/81608804