Skip to main content
Amber Gillis (K2M) 님이 #Data Management에 질문했습니다
How can I change the blocksection/header color of a VF page?  I don't want to change the text.  I want to change the bar the text is displayed on.

 

Thanks!
답변 4개
  1. 2015년 7월 7일 오후 7:52
    The color of the PageBlock/Sections are inherited from the Tab. This means that if you set the tabStyle

     property of the VF Page say like this - 

    ..... tabStyle="Lead" ....

     

    So now, you'll notice that the Lead tab gets highlighted while viewing the Page and the style(coloring

    ) looks similar to that you see on the Lead page - 

    The color of the PageBlock/Sections are inherited from the Tab. This means that if you set the tabStyle property of the VF Page say like this - ..... tabStyle=

     

    Similarly, you can set it to Custom Objects

    too like say - 

    ..... tabStyle="Bookmark__c" ....

    User-added image

     

    You can even apply tabStyle separately your PageBlock like this - 

    <apex:page tabStyle="Bookmark__c">

    <apex:pageBlock title="Page Block Title Here" mode="edit" tabStyle="Lead">

    <apex:pageBlockSection title="Page Block Section Title Here">

    </apex:pageBlockSection>

    </apex:pageBlock>

    </apex:page>

    Here the tabStyle of the page goes to a

    Custom Object while the tabStyle of the pageBlock points to that of the Lead

    object.

    User-added image

     

    So in essence you can create a VF Tab(set the color scheme for that) and the VF Page should inherit automatically. This is cleaner way that overriding the CSS.
0/9000