CSS属性定义背景效果:
background-color :背景颜色
background-image:背景图片
background-repeat: 背景图片水平/垂直平铺
background-attachment:定义图片随滚动轴的移动方式
background-position :定位
background-color:
例:body{ background-color:red;}
css颜色值通常以以下方式定义:
十六进制:#ff0000
RGB:rgb(255,0,0)
颜色名称:red
background-image:
<!-- 默认情况下,背景图像进行平铺重复显示 -->
例: body{background-image:url('paper.gif');}
background-repaeat:
水平方向平铺:background-repeat:repeat-x;
垂直方向平铺:background-repeat:repeat-y;
不平铺:background-repeat:no-repeat;
background-attachment:
背景图片随着滚动轴移动:background-attachment:scroll;
背景图片不随着滚动轴移动:background-attachment:fixed;
继承:background-attachment:inherit; <!-- 初始值为:scroll -->
background-position:
例:background-position:right top; <!-- 定位右上角 -->
背景简写:
body{ background:#fff url('paper.gif') no-repeat scroll right top;}
简写顺序:
background-color
background-image
background-repeat
background-attachment
background-position