html-背景图片固定,复合样式

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css" media="screen">
body{width: 980px;
height: 5000px;
background-color: pink;
background-image: url(img/1.jpg); /*引入背景图片*/
background-repeat: no-repeat; /*不平铺*/
background-attachment: fixed; /*北景图片固定*/
background-position: center 0px; /*居中*/
/*上面的单一样式写法,下面是复合样式写法*/

background:pink url(img/1.jpg) no-repeat fixed center 1px; /*复合样式的写法*/
</style>
</head>
<body>
<div>aaa</div>
<div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>aaa</div><div>

</body>
</html>

猜你喜欢

转载自www.cnblogs.com/pcjbk/p/9782281.html
今日推荐