背景裁切
background-clip属性用来设置元素的背景裁切到哪个盒子,兼容到IE9
background-clip:border-box;-----背景裁切到border区域
background-clip:padding-box;-----背景剪切到padding区域,此时不会在点状线,虚线边框下渲染
background-clip:content-box;-----背景剪切到内容区域
背景起源
background-origin:content-box;------表示图片从什么地方开始显示。
案例演示
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box1 {
width:200px;
height:200px;
border:10px dotted #000;
padding:60px;
background-image:url("abc.jpg.jpg");
margin-bottom:10px;
}
.box2 {
width:200px;
height:200px;
border:10px dotted #000;
padding:60px;
background-image:url("abc.jpg.jpg");
/* 背景剪切到padding区域,此时不会在点状线,虚线边框下渲染 */
background-clip:padding-box;
margin-bottom:10px;
}
.box3 {
width:200px;
height:200px;
border:10px dotted #000;
padding:60px;
background-image:url("abc.jpg.jpg");
/* 背景剪切到内容区域 */
background-clip:content-box;
margin-bottom:10px;
/* 背景起源,从什么地方开始显示图片 */
background-origin:content-box;
}
</style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
</body>
</html>