0

I have a simple VisualForce code:

<apex:page controller="Query_and_upload"  standardStylesheets="True" showHeader="false" sidebar="false">
<apex:stylesheet value="{URLFOR($Resourse.customCSS, 'customCSS.css')}"/>
<body>
<h1>
<apex:sectionHeader title="Please Enter user information and upload LogFile"/>
</h1>
<apex:pagemessages />
<apex:form enctype="multipart/form-data">
   <apex:pageBlock >
      <apex:facet name="footer">
      <apex:outputPanel >
         <apex:commandButton action="{!save}" value="Check and Upload" styleClass="btn"/>
      </apex:outputPanel>
      </apex:facet>
   <apex:pageBlockSection title="User Information">
      <apex:panelGrid columns="2">
         <apex:outputLabel value="First Name" for="inqueryFirstName"/>
         <apex:inputField id="inqueryFirstName" value="{!inquery.First_Name__c}" required="true"/>
         <apex:outputLabel value="Last Name" for="inqueryLastName"/>
         <apex:inputField id="inqueryLastName" value="{!inquery.Last_Name__c}"  required="true"/>
         <apex:outputLabel value="Email" for="inqueryEmail"/>
         <apex:inputField id="inqueryEmail" value="{!inquery.Email__c}"  required="true"/>
      </apex:panelGrid>
   </apex:pageBlockSection>
   <apex:pageBlockSection title="Upload File"  >
      <apex:panelGrid columns="2">
         <apex:outputLabel for="file"/>
         <apex:inputFile value="{!contentFile}" filename="{!nameFile}" id="file"/>
      </apex:panelGrid>
   </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</body>
</apex:page>

And i have a CSS file called customCSS.css that has the following code:

<style type="text/css">

  body{
  padding-left: 11em;
   padding-right: 11em;
   padding-top: 5em;
  font-family: Georgia, "Times New Roman",
        Times, serif;
  color: black;
   font-size: 12pt;
font-weight: 300;
text-align:justify;
   margin: 0em auto;
  width: 1200px;
  background-image: url("images/DSCN5018.gif")
}
  h1, h2, h3
{
  margin: 0;
  padding: 0;
  color: white;
}
p
{
margin-top: 1px;
line-height: 180%;
color: white
}

</style>

I have the css file in a folder called customCSS and inside the folder i have another folder called images. And it has the an image called DSCN5018.gif I zipped the folder called customCSS.zip, and i uploaded the zip file as follows

Name | Setup | Develop | Static Resources | New | Name as customCSS| Upload customCSS.zip |

I know this question is redundant, And i am doing exactly what websites are advising, But my page doesnt seem to change,

Does anyone know why?

  • 1
    You are missing ! before the URLFOR if adding ! does not fix the issue, try uploading just the CSS to the static resource and try : {!URLFOR($Resourse.customCSS)} – Rao Sep 11 '13 at 21:00
  • try to upload the css as static resource than picking it from a folder. – Rao Sep 11 '13 at 21:16
  • rao, that doesnt seem to work to – user2333346 Sep 11 '13 at 21:25
  • 1
    By the way rao, i got it to work without zipping the CSS file, so i uploaded the image separately and the CSS file separately, thanks – user2333346 Sep 12 '13 at 16:31
  • I always blame it on salesforce,but somewhere deep within I know its human error and not salesforce :P. Happy that it works for you when you try the CSS as a static resource and not trying to access from a folder in the SR. – Rao Sep 12 '13 at 16:41
4

You have a typo in the code. You have misspelled Resource. As well as the typo pointed out by Rao, you are missing a '!'

Change

<apex:stylesheet value="{URLFOR($Resourse.customCSS, 'customCSS.css')}"/>

To

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

EDIT:

Another Typo. No ';'

Change

background-image: url("images/DSCN5018.gif")

To

background-image: url("images/DSCN5018.gif");

EDIT:

You mention that images is a sub folder of customCSS, and you have no / to indicate that

Change

background-image: url("images/DSCN5018.gif");

To

background-image: url("/images/DSCN5018.gif");
| improve this answer | |
  • Sorry for the typo, but it still doesn't work!! – user2333346 Sep 11 '13 at 21:15
  • Found another typo, updated the answer – Chris Duncombe Sep 11 '13 at 21:23
  • Think I found another issue regarding the naming of the Resource. I updated the code, try that – Chris Duncombe Sep 11 '13 at 21:34
  • Dunc44, the MyStyles was a typo from me, i actually called it customCSS, i updated my question, sorry about that – user2333346 Sep 11 '13 at 21:36
  • Is that what you meant? – user2333346 Sep 11 '13 at 21:37
0

It sounds like you have a zip file with a folder in it and in that folder is the CSS file you want to access. Why not simplify and put the CSS file directly into the Zip file, with no added folder? Otherwise, when you specify the name of the CSS file, you will need to precede it with the name of the containing folder (after specifying the zip file resource).

Hope this helps!

| improve this answer | |
  • yes that's what i did, thnx – user2333346 Dec 4 '13 at 16:35

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.