0

I have a liferay theme which has some application level images. Also a portlet with its own css.

How can I refer the images in theme from the portlet's css?

Seeker
  • 2,405
  • 5
  • 46
  • 80

2 Answers2

2

I believe that from the CSS files you can't (at least I couldn't think of a way to do this). However, if you expect it to be styled by the theme anyway, you can just have a <div class="hasMyDesiredImage"> and make your theme(s) contain the theme-css to use the images from the theme itself:

e.g. your custom.css:

 .hasMyDesiredImage {
    background: url(../images/my/fancyImage.png);
 }

If you want to address a theme-based image from a portlet itself (where the code is dynamically processed) you can use themeDisplay.getPathThemeImages():

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
0

If you have created a custom theme, then the impages/CSS/JS in theme can be referenced directly using the reference path.

For ex: if Theme project which is in webapps is sample-theme, then you can give path like /sample-theme/images/filename.png