+ Start a Discussion
Force.platformForce.platform 

color of pageBlock

how to change color of pagebolck on vf
Best Answer chosen by Force.platform
piyush_sonipiyush_soni
hi you can change the background color of page block using CSS in your vf page, pleae find out below samlpe
<!-- Page: -->
<apex:page standardController="Account">
    <style>
      .bPageBlock{
       background: yellow !important;
      }
        
    </style>
    <apex:form >
        <apex:pageBlock title="My Contenta " mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="My Content Section " columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.site}"/>
                <apex:inputField value="{!account.type}"/>
                <apex:inputField value="{!account.accountNumber}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
output :
User-added image
Let us know if it helps you, and kindly mark it best answer it this answer helps you so it make proper solution for others in future
thanks
 

All Answers

Suraj TripathiSuraj Tripathi
Hi Arati,

Please try in this way to change color of pageBlock .
 
<apex:page standardController="Contact">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
        $(".bPageBlock").css("background-color","antiquewhite");
        $(".bPageBlock").css("border-color","antiquewhite");
    });
    </script>
    <apex:pageBlock>
        <apex:pageBlockSection >
            HELLO MY Background Color HAS CHANGED
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

Hope it will be helpful for you, please marks this as best if it really helps you.

Regards
Suraj
 
piyush_sonipiyush_soni
hi you can change the background color of page block using CSS in your vf page, pleae find out below samlpe
<!-- Page: -->
<apex:page standardController="Account">
    <style>
      .bPageBlock{
       background: yellow !important;
      }
        
    </style>
    <apex:form >
        <apex:pageBlock title="My Contenta " mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="My Content Section " columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.site}"/>
                <apex:inputField value="{!account.type}"/>
                <apex:inputField value="{!account.accountNumber}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
output :
User-added image
Let us know if it helps you, and kindly mark it best answer it this answer helps you so it make proper solution for others in future
thanks
 
This was selected as the best answer
piyush_sonipiyush_soni
let us know if it helps you, and closed your query with choosing best answer so it make proper solution for others in future