The CSS for the background declaration is invalid. Also there's no
need for tabs and carriage returns. Try this:

button.setHTML("<div style=\"background:transparent url(home.gif) no-
repeat; width:95px; height:23px;\"> Home </div>");

The best practices solution, however, is to have an external
stylesheet with styling rules defined:

.cool-button {
  background: transparent url(home.gif) no-repeat;
  width:95px;
  height:23px;
}

And then add the stylename to the button:

button.setStyleName("cool-button");
button.setText("Home");

This will keep a nice separation of presentation, structure, and
content.

Cheers!

On Sep 24, 9:01 am, abhiram wuntakal <[email protected]> wrote:
> I got some really cool styles with HTML tags and so thought of sticking on
> to it. Any idea why the image which I set on the button using HTML did not
> appear in Firefox?
>
> regards,
> Abhiram
>
> On Thu, Sep 24, 2009 at 4:55 PM, Venkatesh Babu <[email protected]>wrote:
>
> > Try setting the style using a css class rather than the "style" attribute,
> > in the way specified in your code. If you don't have a css file, you can
> > just create the css class within your html file.
>
> > Hope this helps.
>
> > -Venkatesh
>
> > On Thu, Sep 24, 2009 at 2:08 AM, abhiram <[email protected]> wrote:
>
> >> Hi all,
>
> >>   I used the setHTML property for the Button to get some really nice
> >> styles for the buttons in my application. This works perfectly in IE
> >> but does not seem to work in Mozilla and Chrome. In Mozilla and Chrome
> >> I dont see the images on the button which are visible on IE.
>
> >>  My sample code is as below:
>
> >>  button.setHTML("<div style=\"background:url(home.gif) repeat no-
> >> repeat;\r\n\t\twidth:95px;\r\n\t\theight:23px;\"> Home </div>");
>
> >>  Can someone please let me know if I am missing something here?
>
> >> regards,
> >> Abhiram
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to