使用-webkit-filter的blur属性,做个人主页头像

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>个人主页</title>
	<style>
		.box{
			width: 720px;
			height: 400px;
			margin:20px auto;
			overflow: hidden;
			position: relative;
		}
		.box1{
			width: 100%;
			height: 100%;
			vertical-align: top;
			-webkit-filter:blur(4px);
			
		}
		.box2{
			width: 160px;
			height: 160px;
			position: absolute;
			top: 50%;
			left: 50%;
			margin-left: -80px;
			margin-top: -80px;
			border-radius: 50%;
			padding: 8px;
			border: solid 1px #fff;
		}
	</style>
</head>
<body>
	<div class="box">
		<img src="2.jpg" alt="" class="box1">
		<img src="1.jpg" alt="" class="box2">
	</div>
	
</body>
</html>

效果,如下图所示:

 

猜你喜欢

转载自blog.csdn.net/zhangqling/article/details/81637387
今日推荐