+ Start a Discussion

classes in my css overriding by common.css classes



I was using following statement to include my stylesheet in visualforce page.

<apex:stylesheet value="{!$Resource.MyStyle}/MyStyleSheet.css" />


when the page is loaded it will show the proper styles in my css, but after performing some ajax action event, some classes in my css are overriding by common.css style classes.


e.g I am using some btnStyle class for command button, after performing some action, image changes on button.

when I inspect element for that button class will be shown as btn btnStyle class. btn class is class from common.css in salesforce.


I have solved this problem using below line
<link rel="Stylesheet" type="text/css" href="{!$Resource.MyStyle}/MyStyleSheet.css" />


So actually I want to understand which is the standard way to include stylesheet in visualforce page.


ForceMantis (Amit Jain)ForceMantis (Amit Jain)
manjiri, standard way to include style sheet is to use apex tags, but in the end what goes into browser is what you have written using link tag apart from the href will be replaced with correct path to css file.

If second one is working for you it is completely fine to use this syntax also.