简写属性
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title></title> 6 <style type="text/css"> 7 body{ 8 height: 5000px; 9 /*设置背景*/ 10 /* background-color: #BBFFAA; */ 11 /*设置背景图*/ 12 /* background-image: url(img/3.png); */ 13 /*设置背景不重复*/ 14 /* background-repeat: no-repeat; */ 15 /*设置背景图位置*/ 16 /* background-position: center; */ 17 /*设置背景图不随滚动条滚动*/ 18 /* background-attachment: fixed; */ 19 20 /* 21 background 22 通过该属性可以同时设置所有背景相关样式 23 没有顺序要求,也没有数量要求,不写的样式使用默认值 24 */ 25 background: #BBFFAA url(img/3.png) center no-repeat fixed; 26 } 27 </style> 28 </head> 29 <body> 30 </body> 31 </html>
background
通过该属性可以同时设置所有背景相关样式
没有顺序要求,也没有数量要求,不写的样式使用默认值

浙公网安备 33010602011771号