LuckyLuke
LuckyLuke

Reputation: 49057

Can't link to images from CSS in JSF

I am having CSS using the resources folder in JSF and two sub-folders named css and images. I am trying to use some images as background in the css by writing background-image:url('../images/myImage.png'); but it does not work. This is what I use to load the CSS on the page:

<h:outputStylesheet library="css" name="screen.css" />

Upvotes: 1

Views: 211

Answers (1)

Lucas
Lucas

Reputation: 14919

You can use el expressions in your css as long as your WAR structure includes the resources folder under which you have your css folder. See my answer here.

In short, this:

.someClass {
    background-image: url('#{resource['images/image1.png']}');
}

Or something similar

Upvotes: 2

Related Questions