[ 
https://issues.apache.org/jira/browse/WICKET-2263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Vaynberg resolved WICKET-2263.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Igor Vaynberg

urls in css are always processed relative to the location of the css file 
itself. wicket does not, nor will in the foreseeable future, rewrite your css 
resources to correct urls.

you should either keep your images in a fixed location relative to the css file 
or use absolute urls inside css.

> contextPath problem with the inline CSS-es
> ------------------------------------------
>
>                 Key: WICKET-2263
>                 URL: https://issues.apache.org/jira/browse/WICKET-2263
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.4-RC2
>            Reporter: Zoltan Luspai
>            Assignee: Igor Vaynberg
>
> Hi,
> I have some component, which uses images as background CSS. The image is 
> stored outside under the "/WEB-INF/images" so it is accessible on the 
> $contextPath/images/ path. Now I have this in the HTML markup of my component:
> {{{
> <style type="text/css">
>       img.arrow {
>               background-image: url("images/arrow.png");
>       }
> </style>
>       <img src="images/arrow.png"></img>
>       <img class="arrow"></img>
> }}}
> Which renders in the browser as:
> {{{
>     <style type="text/css">
>         img.arrow {
>               background-image: url("images/arrow.png");
>          }
>    </style>
>    <img src="../images/arrow.png"/>
>    <img class="arrow"/>
> }}}
> As visible in the <img> tag the "src" gets correcly modified , and the 
> context-relative path is changed from the "images/arrow.png" to 
> "../images/arrow.png", so the image will be found by the browser.
> On the other hand the "url" or the background-image is left unchanged, so the 
> browser can not find the image.
> I have tried many things, like hacking the <wicket:messages> tag to add 
> contextPath like this (note; the contextPath got resolved using a custom 
> IStringResourceLoader):
> {{{
>     <style type="text/css">
>         img.arrow {
>               background-image: url(<wicket:message 
> key="contextPath"/>images/arrow.png);
>          }
>    </style>
> }}}
> but this does not work either. Any hints how to solve this situation?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to