[SalesForce] Styling a Command Link as Command Button

I'm trying to style a command link as a command button and I have the code for this,

<apex:commandlink value="Add new Contact" action="{!editNewCont}" styleclass="btn MyBtn">

and my CSS goes like this,

.MyBtn{text-decoration:none;padding:4px;}

But for some reason the MyBtn properties (padding is not applied correctly). How do I do this? Also, is there way I could give the "btn" property as part of the CSS so that my styleclass would be like this,

styleclass="MyBtn" instead of styleclass="btn MyBtn"

Please advise.

Best Answer

I can't tell you why the padding isn't being applied without seeing your page, but I suggest that you check to see whether the styling is being overridden by another element; you can do this using the Developer Console.

With regard to your second point, you would need to copy the definition for btn into MyBtn - but if btn is a Salesforce-defined class, this is not a good idea (as your copy may become outdated with future updates to Salesforce).