详解:43 background-origin

2020-10-28 15:25:11 浏览数 (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: 600px;
			height: 400px;
			border:20px dashed rgba(0,0,0,.3);
			padding:20px;
			margin:30px;
			background:url(images/king.jpg) no-repeat left top #abcdef;
		}
		.padding-box{
			background-origin: padding-box;/*padding与content*/
		}
		.border-box{
			background-origin: border-box;/*border与padding*/
		}
		.content-box{
			background-origin: content-box;/*内容*/
		}
	</style>
</head>
<body>
<div class="padding-box"></div>
<div class="border-box"></div>
<div class="content-box"></div>

</body>
</html>

0 人点赞