background-position:<position> [ , <position> ]*
<position> = [ left | center | right | top | bottom | <percentage> | <length> ] | [ left | center | right | <percentage> | <length> ] [ top | center | bottom | <percentage> | <length> ] | [ center | [ left | right ] [ <percentage> | <length> ]? ] && [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
默認(rèn)值:0% 0%,效果等同于left top
適用于:所有元素
繼承性:無
動(dòng)畫性:是
計(jì)算值:指定值
縮寫方式:
background:url(test1.jpg) no-repeat right 20px bottom 20px;
拆分方式:
background:url(test1.jpg) no-repeat left bottom 10px;
要注意的是:設(shè)置3個(gè)或4個(gè)值,偏移量前必須有關(guān)鍵字。也就是說,形如:"10px bottom 20px" ,這樣的參數(shù)設(shè)置是錯(cuò)誤的,因?yàn)?0px前面沒有關(guān)鍵字。
Values | IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome | Android UC |
---|---|---|---|---|---|---|---|---|---|
Basic Support | 6.0+ | 2.0+ | 4.0+ | 3.1+ | 15.0+ | 3.2+ | 2.1+ | 18.0+ | 7.0+ |
3-4個(gè)參數(shù) 以邊界作參考偏移 |
6.0-8.0 | 2.0-12.0 | 4.0-24.0 | 3.1-6.1 | 3.2-6.1 | 2.1-4.3 | 18.0-24.0 | 7.0-9.9 | |
9.0+ | 13.0+ | 25.0+ | 7.0+ | 7.0+ | 4.4+ | 25.0+ |