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>

posted @ 2018-10-13 11:27  零度雨的BLOGS  阅读(2091)  评论(0编辑  收藏  举报