CSS背景

1.css背景 (background)

1.1  背景颜色

background-color:颜色值;   默认的值是 transparent  透明的;

1.2  背景图片(image)

background-image : none | url (url) ;默认为none;

1.3  背景平铺 (repeat)

background-repeat : repeat | no-repeat | repeat-x | repeat-y ;默认值为repeat平铺

1.4  背景位置(position)

background-position : top | center | bottom | left | center | right 方位名词,与顺序无关

1.5 背景固定 (attachment)

background-attachment : scroll | fixed ;默认值为scroll滚动

1.6  背景简写

background: 背景颜色 背景图片地址 背景平铺 背景滚动 背景位置;

background: transparent url(image.jpg) repeat-y  scroll center top ;

1.7  背景透明

background: rgba(0, 0, 0, 0.3);最后一个参数是alpha 透明度 取值范围 0~1之间

2.css三大特性

层叠——后来者居上,就近原则

继承——子继父业,子元素可以继承父元素的样式(text-,font-,line-这些元素开头的可以继承,以及color属性

优先级——根据权重比例来判断优先级

 

 

posted @ 2020-08-30 15:33  xdxbbh123  阅读(94)  评论(0)    收藏  举报