Showing posts with label $Resource in Visualforce pages. Show all posts
Showing posts with label $Resource in Visualforce pages. Show all posts

Sunday, January 25, 2015

How to user apex:stylesheet in visualforce page?

How to user apex:stylesheet in visualforce page?


<apex:stylesheet> 

A link to a stylesheet that can be used to style components on the Visualforce page. When specified, this component injects the stylesheet reference into the head element of the generated HTML page.


This component supports HTML pass-through attributes using the "html-" prefix. Pass-through attributes are attached to the generated <link> tag.



This tag supports following attributes:
Attribute
Description
id
An identifier that allows other components in the page to reference the stylesheet component.
value
The URL to the style sheet file. Note that this can be a reference to a static resource


How to Use Style Sheets in Visual force Pages

Step 1:

Create a CSS file.

Open NOTEPAD or any text editor and type the following code


h1
{
color:red;
}


Save the file with a .css extension (say CssExample.css)

Step 2:

Upload the saved file as a Static resource.

Setup -> Develop -> Static Resources and click on NEW.

Give a name for the static resource say CssExample. Remeber to set the Cache Control as "Public".




Step 3:

Create a visualforce page and paste the following code..

<apex:page standardstylesheets="false" showheader="false">
<apex:stylesheet value="{!$Resource.CssExample}"/>
<h1> This text is displayed using CSS </h1>
</apex:page>


Save the page. Now you can see that the text within <h1> tag is displayed in GREEN color because you have specified so in the CSS file.





More about Visualforce Tags:

Monday, August 11, 2014

How to delete a class in production in Salesforce?

How to delete a class in production in Salesforce?

1. Install Force.com IDE in Eclipse.

2. Connect to the Sandbox Instance using the IDE and find the class or trigger that you want to delete.

3. Open the matching .xml file change the Status XML tag from "Active" to "Deleted" if you want to remove the trigger or class, or to "Inactive" if you want to disable the trigger.

4. Apex class Status can only be changed to "Active" or "Deleted", not "Inactive".







5. Save the file.

6. Select the two files (Code and XML) using Ctrl-click, then right click on one of them. Select Force.com > Deploy to server.

7. Provide your credentials for the production org and follow the steps.





 
| ,