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
Dipu T.PaulDipu T.Paul 

How to give background:url in CSS

Hi all,
 
In  my Vf page i have one css clss like
 

<div class="Title">Test </div>

css :

.Title {

margin:8px 0 0 8px;

font-size:1em;

font-weight:bold;

background:url(../images/TitleBG.gif) no-repeat;

height:31px;

width:783px;

padding:6px 0 0 10px;

}

I have uploaded all the images in the static resources.But i am not getting the back ground image.

I got a code snippet like this from google which is shown below.
 
 
How can i use this.
 
Please give ur suggestions.
jwetzlerjwetzler
You say that you uploaded the images as static resource but it looks like you've uploaded a document based on your link.

Review the doc for Static Resources, then you should be able to refer to them using $Resource and URLFOR.
LessLess

jwetzler wrote:
You say that you uploaded the images as static resource but it looks like you've uploaded a document based on your link.

Review the doc for Static Resources, then you should be able to refer to them using $Resource and URLFOR.




To use a static resource on a page-coded CSS block, you'd do something like:

background-image: url('{!$Resource.resource_name}');


An interesting side note is that if your CSS is stored in the static resource section, you don't even need to use the $Resource tag - the path will default to the same directory as where the CSS file itself is stored, thus finding the image.

background-image: url('resource_name');

Message Edited by Less on 11-12-2008 11:43 AM
Dipu T.PaulDipu T.Paul
Thanks for your valuable suggestion.
VisualForceVisualForce

Hi Less..

    I have store the following code as priintcss in static resource, and I have already stored logo in static resource named logo.

@page {
 
 @top-right {
  content: "Page " counter(page);
 }
                   @top-left{
                                   background-image: url('logo');                              
                  }             
}

I am using following code in VF page..

<apexage controller="HistoryCon" showHeader="false" renderAs="pdf">
 <apex:stylesheet value="{!$Resource.printcss}"/>

          I want to render a PDF file.. I can get a page number in each page but I couldnt get a image...

Where I made a mistake... Give me a solution..