Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
BUG: WinXP: DHTML CSS Background-Image Property Does Not Work with BUTTON Elements
This article was previously published under Q322240
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.
Use one of the following methods to resolve this problem:
- Change the Windows style from XP to Classic:
- Click Start, click Control Panel, and then double-click Display.
- In the Display Properties dialog box, click the Appearance tab.
- 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>
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Steps to Reproduce the Behavior
- 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>
- Save the HTML page and make that sure a .gif file named Image.gif exists in the same directory as the HTML page.
- Make sure that Windows XP style is selected:
- Click Start, click Control Panel, and then double-click Display.
- In the Display Properties dialog box, click the Appearance tab.
- For Windows and buttons, click to select Windows XP style.
- Open the HTML page.
Article ID: 322240 - Last Review: September 22, 2011 - Revision: 5.0
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
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate