背景属性

background: 在一个声明中设置所有的背景属性。

语法: 
background: background-color background-image background-repeat 
background-attachment background-position;

实例:
body
  { 
  background: #00FF00 url(bgimage.gif) no-repeat fixed top;
  }

background-color:规定要使用的背景颜色。

 background-color: #000000;

background-image:规定要使用的背景图像。

background-image:url('bgimage.gif');

background-position:规定背景图像的位置。

(1)可以是top left center right bottom, 如果仅规定了一个关键词,那么第二个值将是"center"。
(2)x% y% 第一个值是水平位置,第二个值是垂直位置。
(3)xpos ypos 第一个值是水平位置,第二个值是垂直位置。

background-size:规定背景图片的尺寸。

background-size:80px 60px;

background-repeat:规定如何重复背景图像。

 background-repeat: repeat;两个方向上重复
 background-repeat: repeat-x; x方向上重复
 background-repeat: repeat-y; y方向上重复
 background-repeat: no-repeat;图像只显示一次

background-origin:规定背景图片的定位区域。

background-origin: padding-box|border-box|content-box;

background-clip:规定背景的绘制区域。

background-clip: border-box|padding-box|content-box;

background-attachment:规定背景图像是否固定或者随着页面的其余部分滚动。

  background-attachment: fixed|scroll;
posted @ 2017-01-03 09:25  叶子陪你玩  阅读(178)  评论(0编辑  收藏  举报