How to maintain Unique styles for your company ?
Each company has its own taste for their styles in web pages. It depends mainly on their brand logo, color, symbols, etc. So, as a developer, you need to follow a consistent approach while styling the components in the pages.
How to reuse standard styles ?
In salesforce, you could reuse the standard/custom object styling in the custom pages. This is done through tabstyle attribute in the page tag.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page tabStyle="Account"> | |
<apex:pageBlock title="TestBlock"/> | |
</apex:page> |
How to follow consistent styles across pages ?
Create a css file called Common.css & upload it into a Static resource. Then, in this file, have all the common styling classes into it.For example, you could have a class for all these following components.
Text Box
Label
Select Box
Date Picket
Option Box
Buttons
TextArea
Image
Section Header
Then, in each page, you can simply include common.css & use the classes, rather than rewriting the styles every time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.TextLabel { | |
font-weight : bold; | |
} | |
.TextInput { | |
width : 300px; | |
font-size : 30px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardController="Account"> | |
<apex:stylesheet value="{!URLFOR($Resource.common_css)}"/> | |
<apex:form> | |
<apex:outputLabel value="Enter Account Name" styleClass="TextLabel"/> | |
<apex:inputText value="{!Account.Name}" styleClass="TextInput"/> | |
</apex:form> | |
</apex:page> |
useful
ReplyDelete