Activity Forums Salesforce® Discussions How to refer static resources in Salesforce Visualforce?

  • shariq

    Member
    September 22, 2018 at 5:02 pm

    CSS file

    <apex:stylesheet value="{!URLFOR($Resource.style_resources, 'styles.css')}"/>

  • Parul

    Member
    September 22, 2018 at 5:55 pm
  • Parul

    Member
    September 22, 2018 at 6:09 pm

    Suppose there is a single file like any single image or standalone css file, that you need to refer in your VF page, then you can directly use the “$Resource.resourceName” to refer the static resource where ‘$Resource‘ is a global variable to use any static resource within visualforce page. You need not to hard code the path of the static resource in VF page code. Below are some examples of the same.

    <apex:stylesheet value=”{!URLFOR($Resource.style_resources, ‘styles.css’)}”/>

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos