0

I'm trying to reference an image on my VF page like so:

        form {
            margin-top: 5px;
            background-image: url("http://www.publicdomainpictures.net/pictures/10000/velka.jpg");
        }

I would like to replace the hard coded URL above with a static resource. I tried following this article: Referencing a Static Resource in Visualforce Markup but I'm not sure how.

Please help

2
  • Just download the image from the url. Then add a static resource as mentioned here, then follow the tutorial you put in your question. Jan 30 '17 at 13:33
  • The problem of the tutorial that I put in my question is that it says I should upload a stylesheet file and also an image, I don't want to upload a stylesheet, I just need the image.
    – Json
    Jan 30 '17 at 13:44
2

Did you try this? After having added the image as a static resource of name 'TestImage' for example.

form {
            margin-top: 5px;
            background-image: url({!$Resource.TestImage});
        }
1
  • No problem. Glad I could help. Jan 30 '17 at 14:12

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.