background: (1)url(image1.png) right bottom, (2)url(image2.png) center, (3)url(image3.png) (4)rgba( 0,0,0,0.35)css
background-position
and background-repeat
. By default they are positioned top left and get repeated at the x- and y-axis.第一张背景图是最靠近可视层的。每个背景图都有通用的背景属性,最重要的是background-position和bckground-repeat。默认是定位在左上角,并且x与y轴重复。Sets the visible range of the background including background images.设置背景图片的有效范围css3
(1)border-box , (2)padding-box,(3)content-boxapp
border-box
, default value). To change this behaviour it’s possible padding-box
and content-box
(Firefox 3.6 uses border
and padding
instead,content
is not supported).元素默认的背景绘制在边框之下,也就是边框会覆盖背景层(默认值border-box)。能够使用paddng-box和content-box来改变这种行为。border-box
) when no border is set.若是在元素设置了边框,超出位置会被截取。即不会绘制到border之下。与不设置border的border-box同样效果。padding-box
when no padding is set, same as padding-box
and border-box
when no padding and no border are set.若是背景设置了padding,除了内容外都截取。与没有padding的padding-box同样,与没有设置padding和border的padding-box,border-box同样。(1)padding-box , (2)border-box,(3)content-boxide
padding-box
, default value). In the presence of a border they start directly within it. Can also be content-box
or border-box
(Firefox 3.6 uses padding
,content
and border
).当设置背景图片时,它是从元素的边界开始(默认是padding-box)。若是存在边框,则在边框内开始。还能够设置content-box和border-box。padding-box
when no border is set.若是设置了边框,并且设置border-box,边框就会覆盖在背景图上。若是没有设置边框则与padding-box同样。padding-box
when no padding is set, same as padding-box
and border-box
when no padding and no border are set.设置了content-box,若是设置了padding,背景图则应用于padding内。和没有设置padding的padding-box同样,和没有设置border与padding的botder-box、padding-box同样。background-size:(1)50% 100%, (2)33% 33%, auto, 100pxthis
50%
of the width of the element (not of the original image size). 第一个值50%是指背景图为元素宽度的50%(并非原始图的尺寸)Can also be set in absolute (px
) or relative (em
) units, can be auto
(original size, default),cover
or contain
. 也能够是px或者em,也能够是auto,cover和contain关键字。In combination with multiple background images the different values are separated by commas.多个背景图时用逗号隔开。(x y 当缺省状态则为auto,例如最后一个则是100px auto)background-size: coverurl
background-size: containspa
原文:http://www.css3files.com/background/code