Is this possible to use a image stored in documents as a background image in css?

So something similar to this --

background-image: url("/servlet/servlet.ImageServer?id=015q0000000c0jh&oid=00DJ0000003KvUz");

Can't seem to figure out the proper syntax here. Thanks in advance!

  • I've got the same problem. I can't use static resource because when you are downloading the template as a Word document, it doesn't render the image. If you use an image stored as a document, then the word do render the image. That's why I need to use an image stored as a document as a background image. Feb 7, 2017 at 18:04

1 Answer 1


For a variety of reasons, this would not be a good thing to try to do. Images stored as a document are stored as blobs and will not always render properly on a visualforce page. You should copy the image into a static resource.

More importantly, Visualforce pages are served from a different server than your Salesforce instance and a static resource will be cached while an image stored as a document would not.

  • this is for a visualforce email template, so static resource did not seem to be an option
    – nickforce
    Aug 31, 2015 at 16:40
  • 1
    You can reference a static resource in a visualforce email template just like you can in any custom visualforce page you might create.
    – crmprogdev
    Aug 31, 2015 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .