background-position Keyword Order
In early February 2002 an obscure bug was uncovered in Mozilla 0.9.8.
This bug can affect authors who use the background-position
keywords right or left in conjunction with the
keyword center. The bug is triggered by the appearance of
these keywords in either the shorthand property background
or the property background-position. While a patch exists
for this bug and it is expected to be corrected in Mozilla 0.9.9, the
bug still affects Netscape 6.0 through Netscape 6.2.1.
The Problem
Due to a parsing error in the affected browsers, any background-related
declaration that contains the keyword combinations center left
or center right will be ignored. The combinations
left center and right center do not trigger this bug;
neither do any other combinations of keywords that involve center,
such as center top.
See Bugzilla entry #124193,
which contains a test case
that illustrates the problem.
In the case of background, the entire declaration
will be ignored if this bug is triggered. For example:
background: white url(smile.png) center left repeat-y scroll;}
The browser will treat the entire declaration as if it did not exist, thus preventing the setting of the other background values such as color, image, and so on. Reversing the order of the position keywords will avoid the bug.
Recommendations
-
When using either the property
backgroundor the propertybackground-position, the background position keywordcentershould come second if the other value isrightorleft. -
In general, it is a good idea to always put the horizontal
keyword (e.g.,
left) before the vertical keyword (e.g.,top). Acquiring this habit will enable authors to avoid this bug in all cases, and to avoid authoring errors when using length and percentage values to set the background position. When using such values, the horizontal value must always come first.
