Html 中的背景(background)

来源:互联网 发布:python入门视频 编辑:程序博客网 时间:2024/06/08 05:42

Html 中的背景(background)

background-color : transparent | color

注:

transparent默认值。背景色透明。

Color : 指定颜色。

background-imagenone | url(1.jpg)

注:(图片与html文件同目录)

 

background-repeatrepeat|no-repeat|repeat-x|repeat-y

注: (图像小的时候比较明显)

repeat 背景图片在纵向和横向上平铺(默认值)

no-repeat背景图片不平铺

repeat-x 横向平铺

repeat-y 纵向平铺

background-attachmentscroll | fixed

scroll 背景图片随对象内容滚动

fixed 背景图像固定

 

background-postion left|center|right|top|center|bottom

background-postion: 30px 40px;   (x ,y) 水平,竖直

注意:

在做项目时,许多小DIV 公用同一张背景图片,这时就是用到了

Background-position ,即每个DIV 调用不同的position



div元素不动。直接移动背景图片实现公用同一张背景图片的目的。


把背景图片往下拉,属性值向y 轴正方向变化

背景图片往上拉。 属性值向y 轴负方向变化

把背景图片往左拉,属性值向x轴负方向变化

把背景图片往右拉,属性值向x 轴正方向变化


Background 集中设置:

background:  gray  url()   no-repeat   500px  400px

body 也有背景的各种属性。


0 0