http://www.runoob.com/css/css-background.htmlcss
http://www.w3school.com.cn/css/css_background.asphtml
CSS 背景属性用于定义HTML元素的背景。url
CSS 属性定义背景效果:spa
background-color 属性定义了元素的背景颜色.code
CSS中,颜色值一般以如下方式定义:htm
body {background-color:#b0c4de;} h1 {background-color:#6495ed;} p {background-color:#e0ffff;} div {background-color:#b0c4de;}
background-image 属性描述了元素的背景图像.blog
默认状况下,背景图像进行平铺重复显示,以覆盖整个元素实体.图片
body {background-image:url('paper.gif');}
默认状况下 background-image 属性会在页面的水平或者垂直方向平铺。get
background-repeat:repeat-x; //只在横轴方向重复it
background-repeat:repeat-y; //只在纵轴方向重复
background-repeat:repeat; //默认的应该是这个,横轴和纵轴方向都进行重复
background-repeat:no-repeat; //不重复
background-repeat:space; //横轴和纵轴方向都重复,可是图片重复的时候,会加空格。最后造成网状的效果
background-repeat:no-repeat;
background-position:right top;
为了简化这些属性的代码,咱们能够将这些属性合并在同一个属性中.
背景颜色的简写属性为 "background":
body {background:#ffffff url('img_tree.png') no-repeat right top;}
当使用简写属性时,属性值的顺序为::
以上属性无需所有使用,你能够按照页面的实际须要使用.
background-attachment:fixed;