Thursday, 8 August 2013

ASP.Net button won't render background-image

ASP.Net button won't render background-image

I've checked most of the linked questions here on this topic and also in
asp.net forums and I am stuck. I have the following in one of my .aspx
pages:
<asp:button ID="btnAdmin" runat="server" Width="70px" Height="30px"
Text="Admin"
ToolTip="Facilities for administrators"
CssClass="buttonStyleAdmin">
</asp:button>
I have the following in my .css file:
.buttonStyleAdmin
{
background-color: transparent;
background-image: url('imgBlue-button-base.png');
font-size: 1.0em;
cursor: pointer;
}
I understand the url syntax should be relative to the location of the CSS
file. After some trials with the url pointing to the images directory of
the web, I gave up and copied the above .png file to the root of the web;
that is, it is adjacent to the .css file itself.
I have used both Google developer tools and Firebug in Firefox and the
matched CSS rules seem to be correct. That is, I can hover over the
section of the tool and the URL resolves such that the image itself is
displayed.
Here is the Firebug view of the rendered page:
If I can get this to resolve with both the .png file and the .css file in
the root of the website, then I'd like to change the reference to the
images folder where all the other images are gathered but with this
failing with both files in the root of the web, I clearly need some advice
on what could be wrong. I am using Visual Studio 2008 on a webserver
running .Net Framework 3.5 (Windows Server 2003).

No comments:

Post a Comment