css背景
一.背景颜色
1.语法:
background-color:颜色值;
默认值为transparent
二.背景图片
1.
background-image:url(路径);
三.背景平铺
1.
background-repeat:repeat/repeat-x(沿x轴平铺)/no-repeat(不平铺);
四.背景位置
1.background-position:x轴 y轴(方位名词/精确单位);
超大背景图片一般写:center top
2.方位名词:
x轴:left,right,center
y轴:left,right,center
3.实例:
background-position:10px 50px;
10px是距离最左边(x),50px是距离最上面(y)
五.背景附着
1.
background-attachment:fixed(固定)/scroll(滚动);
六.背景简写
1.background:背景颜色 背景图地址 背景平铺 背景滚动 背景位置;
七.背景透明
1.语法:
background:rgba(0,0,0,0.3);
最后一个参数是alpha,取值在0~1之间