2017  Kodetalk | Feedback | Privacy Policy | Terms | About

How to add a background images in a JSF application using richfaces and CSS

.rich-ddmenu-label {      background-image: url("images/the_image.gif");  }

But that doesn"t seem to even try and put a image anywhere.

I can use an image using


I don"t know how to put text on top of it though.


Assuming the element in question is getting a class="rich-ddmenu-label" applied to it, the problem is likely the path to the background image.

The path is relative to where the CSS is located. If it's in an external file, it should be relative to that, e.g.:



the CSS should be:

background-image: url("../images/the_image.gif");

If the CSS is inline on the HTML page, it will be relative to the current path. So if the page is located at http://server/path/to/page, it will look for the image at http://server/path/to/page/images/the_image.gif, when you probably meant http://server/images/the_image.gif.

Answer is