详解:41 background-attachment

<!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{
			height: 150px;
			border:1px solid gray;
			background-image:url(images/king1.jpg);
			margin:50px;
			overflow-x:hidden;
			overflow-y:scroll;
			background-repeat: no-repeat;
		}
		.scroll{
			background-attachment: scroll;/*主视图:浏览器页的滚动条,本地视图:页面内的滚动条,以背景为例,他会和主视图一起滚动,本地视图不动*/
		}
		.fixed{
			background-attachment: fixed;/*因为是相对于窗口进行固定的哈,背景只在页面的某一个位置,固定的位置哈*/
		}
		.local{
			background-attachment: local;/*主视图本地视图都会动*/
		}
	</style>
</head>
<body>
<div class="scroll">
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
	background-attachment:scroll,default,默认值<br/>
</div>
<div class="fixed">
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
	background-attachment:fixed,相对于窗口固定<br/>
</div>
<div class="local">
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
	background-attachment:local,相对元素内容<br/>
</div>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>
<p>this is a test</p>

</body>
</html>

猜你喜欢

转载自blog.csdn.net/qq_37805832/article/details/107587690
41
今日推荐