1

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. – David Boces Vela Feb 7 '17 at 18:04
4

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.

| improve this answer | |
  • this is for a visualforce email template, so static resource did not seem to be an option – nickforce Aug 31 '15 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 '15 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.