I have a visual force page which uses pageblock tag:

<apex:pageblock title="Sample">


I would like to make the background color of title="Sample" as green. How can I add styles to the pageblock tag. I tried tabstyle but seems like it does not serve the purpose.

1 Answer 1


I don't see a Salesforce supported way of doing this. But for a little bit hacking into this you can use the below css code which is working for me:

body .bPageBlock .pbHeader {
    background-color: Green; 

You don't need to add an class or attributes in your html for using this.

  • Thanks. What if I don't have a html tag in my code. Is it still doable? Any Hack for that?
    – SfdcBat
    Jun 1, 2016 at 5:00
  • Sorry , I tried and it worked with out <html> tags. THanks
    – SfdcBat
    Jun 1, 2016 at 5:01

You must log in to answer this question.

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