背景-位置-x (背景-位置-y)是标准的 W3C CSS 属性吗?

我很担心 background-position-xbackground-position-y。 Gecko (Firefox)和 Presto (Opera)不支持它们,但 Webkit (Chrome,Safari)支持..。

是否有人知道(与官方参考) ,如果这是(或将)包括在标准?

51487 次浏览

I guess in some sense you've already answered your own question. No, both background-position-x and background-position-y are nonstandard.

Splitting background-position into -x and -y was proposed for CSS 3 but it got rejected as the working group “considered the use case too weak to introduce new properties for.” Additionally, there seemed to be some ambiguity concerns with multiple background images and CSSOM, the API behind CSS. I’m not sure how WebKit and Trident did implement them and how they addressed these concerns.

The CSS WG blob has just reported yesterday that there will be “no change to background-position or transform-origin syntaxes.” The reason is probably due to not getting any further delays.

Maybe it will get added to CSS 4. There is a current thread on the www-style@w3.org mailing list that you might find interesting.


Update    So apparently these properties have been approved for CSS 4 (see [CSSWG] Minutes Telecon 2014-04-16):

RESOLVED: background-position-x/-y, background-repeat-x/-y approved for level 4 of backgrounds and borders.

background-position-x and background-position-y are now part of the level 4 of Backgrounds and Borders standard.

RESOLVED: background-position-x/-y, background-repeat-x/-y approved for level 4 of backgrounds and borders.