1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title></title> 6 </head> 7 8 <script type="text/javascript"> 9 </script> 10 <style type="text/css"> 11 body{ 12 /* 13 height: 5000px; 14 background-color: #bfa; 15 background-image: url(img/3.png); 16 background-repeat: no-repeat; 17 background-position: center center; 18 /* 设置背景图片不随滚动条滚动 19 background-attachment: fixed; 20 */ 21 /* background 22 简写属性 通过该属性可以同时设置所有背景相关的样式 23 没有顺序 数量 的要求 不写的样式使用默认值 24 */ 25 background: #bfa url(img/3.png) center center no-repeat fixed; 26 27 } 28 </style> 29 <body> 30 31 </body> 32 </html>
本文详细介绍了CSS中body标签背景属性的使用方法,包括背景颜色、背景图片、背景重复方式、背景定位以及背景固定等,通过一个简洁的例子展示了如何综合运用这些属性。
4460

被折叠的 条评论
为什么被折叠?



