I have designed custom detail-views using Visual-force to show on clicking custom tabs. I want to change the color of the tab when selected. enter image description here

As you can see in this picture, Here I have clicked on tab Relationship Management. On this, I want to change the color of Relationship Management tab, But when i click on this tab, Home tab is focused and it is looking like we have clicked Home Tab.

I am using this code to open a custom view on clicking this particular tab,

My Custom-Tab' Object properties are:

enter image description here

And My Custom-tab properties are: enter image description here

My visual-force Code is:

<apex:page controller="RelationshipManagement_ApexClass" >
<apex:form id="RelationshipManagementForm">
    <apex:commandButton action="{!GoToLeads}" value="Leads" id="Leads_Link" style="background:YellowGreen; height:30px;"/>&nbsp;
    <apex:commandButton action="{!GoToContacts}" value="Contacts" id="Contacts_Link" style="background:YellowGreen; height:30px"/>&nbsp;
    <apex:commandButton action="{!GoToAccounts}" value="Accounts" id="Accounts_Link" style="background:YellowGreen; height:30px"/>&nbsp;
    <apex:commandButton action="{!GoToOpportunities}" value="Opportunities" id="Opportunities_Link" style="background:YellowGreen; height:30px"/>&nbsp;
    <apex:commandButton action="{!GoToClient_Relationship}" value="Client Relationships" id="Client_Relationships_Link" style="background:YellowGreen; height:30px"/>&nbsp;

Any way to do this? Please help.

1 Answer 1


You need to add tabStyle attribute in you visualforce page

<apex:page controller="RelationshipManagement_ApexClass" tabStyle="Account" >

Instead Account use your sobject API Name .

Or if it is VF page tab

then tabStyle="VFPageTabName__tab"

You need to add your VF page Tab name here and append the __tab

  • I have checked it out. But it only removes focus from Home tab, means Now home tab is also has same color as other tabs have, but selected tab does not change its color. Jun 7, 2016 at 11:58
  • I want to change color of selected tab as Home tab have in attached screenshot. Jun 7, 2016 at 11:59
  • @KhawajaM.Awais Yes I got your point. You need to check the your VF page Tab API Name.. Use that in tabStyle attribute. I guess it will Relationship_Management and you need to use tabStyle="Relationship_Management__tab". Check the VF page tab name is it correct or not ? if you don't specify the correct one it will take the home
    – Ratan Paul
    Jun 7, 2016 at 12:00
  • @KhawajaM.Awais is it resolved?
    – Ratan Paul
    Jun 8, 2016 at 4:17
  • It is giving me error that "Invalid tabStyle 'Relationship_Management__tab' specified." If I remove "__tab" from tabStyle, It is giving me error "Invalid tabStyle 'Relationship_Management' specified. If you are trying to reference a custom Visualforce tab, you must append '__tab'." Jun 8, 2016 at 5:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .