background-position Keyword Order

Summary: Learn about a work around for bug 124192 in Netscape 6.2/Mozilla 0.9.8 where keyword order in the CSS background-position property can affect Netscape 6.2/Mozilla. 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 bug 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.


  • When using either the property background or the property background-position, the background position keyword center should come second if the other value is right or left.
  • 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.

Original Document Information

  • Author(s): Eric A. Meyer, Netscape Communications
  • Last Updated Date: Published 04 Mar 2002
  • Copyright Information: Copyright © 2001-2003 Netscape. All rights reserved.
  • Note: This reprinted article was originally part of the DevEdge site.

Document Tags and Contributors

Contributors to this page: CitizenK, Mathieu Deaudelin, Dria
Last updated by: Mathieu Deaudelin,