The Google/GWT example of creating an ImageResource is understood:
interface MyResources extends ClientBundle { @Source("image.png") ImageResource image(); @Source("my.css"); CssResource css(); } @sprite .myImage { gwt-image: 'image'; }
I understand how to use ImageResources and apply style names, however...
In my application, I have multiple themes that are applied to various widgets using CSS and deferred binding. So I have defined a CSS rule ('background') that I would like to use the .myImage class, but it does not do anything:
background { background-attachment: fixed; background-image: .myImage; //?? This is the question! background-size: contain }
What is the syntax for using the .myImage class within the 'background' CSS property? It seems I should be able to specify the .myImage class as the argument for background-image.
Edit: Did some more research and found the correct syntax to do this using a DataResource.
MyClientBundle extends ClientBundle { //Background Image @Source("resources/background.png") DataResource backgroundImage(); }
(mypanel.css)
@url background backgroundImage; .myPanel { border-radius: 0px; background-color:#ffffff; opacity:0.6; background-image: background; }
If you add "myImage" as style name to any widget, it will set those widgets' background...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With