详解:40 background-repeat

2020-10-28 15:26:09 浏览数 (2)

代码语言: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;
			margin:100px;
			background-image:url(images/king1.jpg);
		}
		.box1{
			background-repeat: repeat;//这种垃圾我就不说了。
		}
		.box2{
			background-repeat:space;/*图片尽可能多放进去(行3个,列三个),剩下是空隙的。*/
		}
		.box3{
			background-repeat:round;/*行三个列三个都会至容器大小,完美适合的哈*/
		}
	</style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>

</body>
</html>

0 人点赞