Actually, I removed all the "background" attributes and added them as
"background:url(mygif.gif);" in the stylesheet, that I add to the header
with:
add(HeaderContributor.forCss(FrameworkStaticResource.class, "style.css"));
If I am not mistaken, this should pick the background images up from the
same package/directory as the stylesheet, right?
Al Maw wrote:
>
> wfaler wrote:
>> Hi,
>> I want to use a ResourceReference (or something comparable) to set the
>> background-attribute of a td-cell with an image on my classpath.
>> How do I achieve this?
>> It is quite straightforward for images, but it gets trickier with
>> background-images to other html elements..
>
> If you object to style attributes on your HTML tags, then you can do
> this by writing stuff out to the <head> of your page.
>
> private static final ResourceReference IMAGE = /* ... */;
> ...
> final Component component = /* ... */;
> page.add(new AbstractBehavior() {
> public void renderHead(IHeaderResponse response) {
> String url = urlFor(IMAGE);
>
> String foo = "<style>\n";
> foo += "#" + component.getMarkupId() + " {\n";
> foo += "background-image: url(" + url ")\n;";
> foo += "}\n";
> foo += </style>";
> response.renderString(foo);
> }
> });
>
> Should work. ;-)
>
> Regards,
>
> Al
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Using-Resource-to-provide-background-attribute-to-td-tag--tf4515517.html#a12882758
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]