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
KRISHNAMURTHY ANANTHARAMAKRISHNANKRISHNAMURTHY ANANTHARAMAKRISHNAN 

How to change background color in pageblocksection in VF page?

I have created a VF page using a custom controller and I wanted to change background colour of the pageblocksection as it defaults to blue. The issue is it changes in the preview but when I add it to sites it defaults to blue.

Preview:
User-added image
Using Sites:

User-added image
<apex:page controller="i2" >
    <style>
.bPageBlock {
border-top: 0px;
}
</style>
    <apex:form>
        <apex:pageBlock title="Invoice" mode="maindetail">
            
            
            <apex:pageMessages id="showmsg"></apex:pageMessages>
            <apex:pageblockButtons location="Bottom" >
                <apex:commandButton action="{!save}" value="save" >
                </apex:commandButton>
            </apex:pageblockButtons>
            
            
            <apex:pageBlockSection columns="1" title="Invoice Details">
                <apex:inputField value="{!acc.Name}"/>
                <apex:inputField value="{!acc.Total_Amount__c}"/>
                <apex:inputField value="{!acc.Password__c}"/>
             	
   
            	</apex:pageBlockSection> 
            
            
            <apex:pageBlockSection columns="1" title="Invoice Line Items Details">
                <apex:inputField value="{!abb.Name}"/>
                <apex:inputField value="{!abb.Price__c}"/>
                <apex:inputField value="{!abb.Invoice__c}"/>
            </apex:pageBlockSection> 
            
        </apex:pageBlock>
    </apex:form>
    
    
    
</apex:page>

 
Best Answer chosen by KRISHNAMURTHY ANANTHARAMAKRISHNAN
Ashish Singh SFDCAshish Singh SFDC
Hi Krishnamurthy,

Just add a tag tabStyle="API name of the sObject".

Example:
<apex:page tabstyle="Permission_Set__c">

Thanks,
Ashish Singh​​​​​​​

All Answers

Ashish Singh SFDCAshish Singh SFDC
Hi Krishnamurthy,

Just add a tag tabStyle="API name of the sObject".

Example:
<apex:page tabstyle="Permission_Set__c">

Thanks,
Ashish Singh​​​​​​​
This was selected as the best answer
KRISHNAMURTHY ANANTHARAMAKRISHNANKRISHNAMURTHY ANANTHARAMAKRISHNAN
Hi Ashish, How do I change the background color of the page Blocksection? As I said before it works fine when I click on preview but when I add it to a public site it changes to blue. Please help.
Ashish Singh SFDCAshish Singh SFDC
Hi Krishnamurthy,

Did it solved you're problem, if not then could you please put screenshot and mark what exactly you wan't to achieve.

Also few sugestion, if you,ve already used tabset and specified sObject API name, you must get look and feel of that particular object. Additionally at pageblock you can specify attribute mode ="edit" to light the dark color and at pageblocksection add an attribute collapsible="false" to remove arrow and prevent drop down.

Thanks,
Ashish Singh.