<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to get web resouces images defined in a CSS file?</title><link>https://answers.axonivy.com/questions/85/how-to-get-web-resouces-images-defined-in-a-css-file</link><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;In an HTML dialog, if I use either of the following instructions for importing a style: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;h:outputStylesheet name="portlet/css/presential.css"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;link rel="stylesheet" href="#{resource['portlet/css/presential.css']}" type="text/css"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the CSS file is loaded (see line #1 below) with the request attribute "&lt;strong&gt;?ln=xpertivy-14-WebContent&lt;/strong&gt;".&lt;/p&gt;
&lt;p&gt;Unfortunately, it cannot find the images defined in the CSS (see 2 last lines).
Notice that the request attribute above is not appended to the image request.
&lt;img alt="alt text" src="/upfiles/2013-11-18_17_14_13-screenshot.png"&gt;&lt;/p&gt;
&lt;p&gt;This could be important because if I manually request the following URL:
&lt;strong&gt;&lt;code&gt;http://localhost:8082/ivy/faces/javax.faces.resource/portlet/images/clock24.png?ln=xpertivy-14-webContent&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I can successfully get the clock24.png image.&lt;/p&gt;
&lt;p&gt;Is it actually a bug, or is there a particular way to do it?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/85/how-to-get-web-resouces-images-defined-in-a-css-file" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 19 Nov 2013 10:01:12 -0500</lastBuildDate><item><title>Answer by Peter Stöckli</title><link>https://answers.axonivy.com/questions/85/how-to-get-web-resouces-images-defined-in-a-css-file/89</link><description>&lt;p&gt;It should be possible to access images in the webContent folder if you reference the image similar to this in the .css file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;.my-icon
{
   background-image:url(#{resource['portlet/images/clock24.png']}) !important;
}
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Peter Stöckli</dc:creator><pubDate>Tue, 19 Nov 2013 10:01:12 -0500</pubDate><guid>https://answers.axonivy.com/questions/85/how-to-get-web-resouces-images-defined-in-a-css-file/89</guid></item><item><title>Answer by Nikel Weis</title><link>https://answers.axonivy.com/questions/85/how-to-get-web-resouces-images-defined-in-a-css-file/88</link><description>&lt;p&gt;It does not seem to be possible to access images within the webContent-folder from an externally loaded style-sheet. Maybe as a workaround: If you are using a PageTemplate, just put your style-definitions using images there. The code would be:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; url("#{ivy.html.wr('task_abort.png')}")
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;...whereas the prefered way is to put in the CMS.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; url("#{resource['ivy-cms:Images/image']}")
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nikel Weis</dc:creator><pubDate>Tue, 19 Nov 2013 09:09:08 -0500</pubDate><guid>https://answers.axonivy.com/questions/85/how-to-get-web-resouces-images-defined-in-a-css-file/88</guid></item></channel></rss>