详解:42 background-position 记住,是左右上下的顺序的哈

2020-10-28 15:25:28 浏览数 (1)

代码语言:javascript复制
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" type="text/css" href="css/reset.css"/>
	<style type="text/css">
	div{
		width: 500px;
		height: 500px;
		border:1px solid red;
		background-image:url(images/king1.jpg);
		background-repeat: no-repeat;
	}
	.box1{
		background-position: right bottom;
	}
	.box2{
		background-position: right 50px bottom 100px;
	}
	.box3{
		background-position: left -50px top -100px;
	}
	</style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>

</body>
</html>

0 人点赞