I have a Static Resource (Hardcoded URL) and a VF page for that. I want to get rid of the hard coded values and refer the static resource in my VF page. In order to do that i created a zip file of static resource with CSS and Image.Please let me know how can i refer and what changes to be done to the CSS file.

Part of the code:


<apex:page StandardController="KB__kav" extensions="ArticleExtension" showHeader="false" sidebar="false" standardStylesheets="true" title="{!KB__kav.Title}">

    <style> div.pbSubheader
        background-color:blue !important;
        border-color: none !important

<body class="hasMotif knowledgeTab">

<knowledge:articleRendererToolBar canVote="true" articleId="{!$CurrentPage.parameters.id}" rendered="true"/>

<apex:stylesheet value="{!$Resource.kb_css}" />
     <apex:outputField value="{!KB__kav.Document__c}"/>



div.content2015 h1{
    color : #003366;
    margin: 0px 5px 8px 0px;
    padding-left: 5px;
    padding-right: 170px;
    padding-bottom: 15px;
    padding-top: 0px;
    background-image: url("https://c.cs3.content.force.com/servlet/servlet.FileDownload?file=015Q0000000Ob8d");
    background-repeat: no-repeat;
    background-position: 100% 0%;
    font-size: 22px;
    font-weight: bold;
    font: arial, sans-serif;



2 Answers 2


As @crmprogdev says, you will probably find the official Salesforce resources helpful. In this specific case, you should put both the CSS and image into a static resource like so:


You then change your CSS to refer to the image with a relative URL:

background-image: url("../img/content2015.png");

Welcome to SFSE sha. I recommend the following resources Visualforce Workbook, the Visualforce Developer’s Guide where the answers to your very basic questions are clearly explained and well documented. I also highly recommend you visit Trailhead and go through the Visualforce Module where I think you'll learn a great deal on how to do create Visualforce pages.

You must log in to answer this question.

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