function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
srinu vassrinu vas 

background image

iam unable add background image in vf pages by below code
css code: 


<style type="text/css">
body { background-image: url("{!URLFOR($Resource.myStyles, 'images/logo1.gif')}")
}
 
and i zipped image and css file added into  static source

apex code:

<apex:page showHeader="false" sidebar="false">
<apex:stylesheet value="{!URLFOR($Resource.example, 'example.css')}"/>
</apex:page>


please solve my problem
Arunkumar RArunkumar R
To display image from static resource use <apex:image> tag.

<apex:image url="{!URLFOR($Resource.example, 'images/Bluehills.jpg')}" width="50" height="50" />

Reference : http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_image.htm
Gopal RathoreGopal Rathore
Hi, srinu vas

Your Code Syntex Is Correct. Is Your Static Resource Is Public. and Check Your Zip File Name Or Its Path Is Correct.

Thanx And Regards 
Gopal Rathore

srinu vassrinu vas
.
  1. i have written a code like
  2. i have place mybackground.gif image into images folder
  3. created css name with mystyle.css file having code 
  4. body {background-image: url(mybackground.gif);}
  5. both images and css files places into zip file
  6. uploaded into static source named as  MyStaticResources
  7. apex code
<apex:page showHeader="false">
<apex:stylesheet value="{!URLFOR($Resource.MyStaticResources, 'mystyle.css')}"/>

</apex:page>


but it is not working please give me sugestion .........


Gopal RathoreGopal Rathore
Hi Srinu vas

if u have folders in your zip. so u have to follow path as zip.
like this code
in this code static reource name is MyStaticResources and mybackgroundimage.gif is in images folder and css in css folder. so i write this code. which is working.
<apex:stylesheet value="{!URLFOR($Resource.MyStaticResources, 'css/mystyle.css')}"/>

body{background-image:url("{!URLFOR($Resource.MyStaticResources, 'images/mybackground.gif')}"; }