Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: ocean10000
What code are you using for the background URL? Your CSS should look something like background:url(path/to/image.gif). Also, it's important to remember that the path you use is relative to location of the CSS file.
BUT it displays the empty image box
I'm not sure that I quite understand you here - do you mean a broken link icon?
CSS will not allow you to set a URL for images, the suggestion of using a background image may work, but how will you assign the button action to the image? Using a transparent gif? Or assigning some action to the layer that is holding your background image?
Well I am using the code:
<asp:ImageButton id="mybutton" runat="server" CssClass="myclass"/>
in my external CSS I am using the background code that you provided. when I do that it shows up just fine the image that I mapped to. But you know when there is a picture object and there is no picture for it there is a box and the little color thingy...( I know what an explanation ). Basically an empty image for an image icon or object that wasn't set to an image. drag an image object to a form without doing anything to it and that is what comes up but with the picture that I specified as a background in the CSS. I tried transparent gif's and the whole point is to be able to change the path from the style sheet and the name of the image too. The action I am not worried about I am just worried about the stupid empty image box. I need to get rid of them or find something that will allow you to just set a path for the object within a CSS. Like you said I don't know if I can do that or not but I would think that within ASP.NET maybe you can get rid of the boxes? Anyhoo I hope that helps....
I don't think that CSS is going to be of help to you here. CSS will allow you to add styles to an object, but in your case, the image button should have a URL - which is why, I think, that you are getting the broken image icon.
You cannot specify (to the best of my knowledge) the url of an image within CSS - it was never designed to do this. Widths, heights, borders, visibility etc. - CSS is the job, but the actual location of the image file, no go.
You could use a layer with a background (instead of the imageButton - but I don't think that this will be very beneficial...
To be honest, as you say, I don't think that CSS is going to help you here. I can't think of any alternative though. :(
When I get the time (2016, it's looking like!), I plan to upgrade to .NET. And when I do, I'll come looking for you!
So to solve your problem, try this class for your button:
When I took out the "background-color: black;" the texture doesnt show up. I always set the bg color, so i never noticed it.
Hope this helps.