CSS 允许应用纯色作为背景,也允许使用背景图像创建相当复杂的效果。

  参考:http://www.w3school.com.cn/css/css_background.asp

  • 背景色
p {background-color: gray; padding: 20px;}
  • 背景图像
body
{
background-image: url(bg.png);
background-repeat: repeat-y;
background-position: center;
background-attachment: fixed
}
属性描述
background简写属性,作用是将背景属性设置在一个声明中。
background-attachment背景图像是否固定或者随着页面的其余部分滚动。
background-color设置元素的背景颜色。
background-image把图像设置为背景。
background-position设置背景图像的起始位置。
background-repeat设置背景图像是否及如何重复。
05-11 14:07
查看更多