Article ID: 322240 - Last Review: September 22, 2011 - Revision: 5.0

BUG: WinXP: DHTML CSS Background-Image Property Does Not Work with BUTTON Elements

System TipThis article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.
This article was previously published under Q322240

On This Page

Expand all | Collapse all

SYMPTOMS

The DHTML cascading style sheet (CSS) background-image property does not work with BUTTON elements in Microsoft Windows XP when the Windows display is set to use Windows XP style.

RESOLUTION

Use one of the following methods to resolve this problem:
  • Change the Windows style from XP to Classic:
    1. Click Start, click Control Panel, and then double-click Display.
    2. In the Display Properties dialog box, click the Appearance tab.
    3. For Windows and buttons, click to select Windows Classic style.
  • Internet Explorer 6.0 uses the new Windows XP themes to render its controls. Add a meta tag to disable themes on the page:
    <meta http-equiv="msthemecompatible" content="no">
    					
  • Use the background property instead of the background-image property:
    <button style="background='url(image.gif)';">show background image</button>
    					

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create a new HTML file, and then paste the following code in the file:
    <HTML> 
    <HEAD> 
    <TITLE></TITLE> 
    </HEAD> 
    <BODY> 
    <button style="background-Image='url(image.gif)';">show background image</button><br><br> 
    </BODY> 
    </HTML>
    					
  2. Save the HTML page and make that sure a .gif file named Image.gif exists in the same directory as the HTML page.
  3. Make sure that Windows XP style is selected:
    1. Click Start, click Control Panel, and then double-click Display.
    2. In the Display Properties dialog box, click the Appearance tab.
    3. For Windows and buttons, click to select Windows XP style.
  4. Open the HTML page.

APPLIES TO
  • Microsoft Internet Explorer 6.0, when used with:
    • Microsoft Windows XP Home Edition
    • Microsoft Windows XP Professional
    • Microsoft Windows XP Media Center Edition 2005 Update Rollup 2
    • Microsoft Windows XP Tablet PC Edition
Keywords: 
kbbug kbnofix KB322240