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
SamCousinsSamCousins 

How do I center pageBlock headers?

I can center pageBlockTable headers no problem, but I can't get pageBlock headers to center. 

Can anybody help me with this? Thanks.
Best Answer chosen by SamCousins
Pramodh KumarPramodh Kumar
Here is the small snippet for table header

Let me know if you have any issues.
<style>     
    .table-header{
          text-align:center;
    }
</style>
<apex:pageBlockTable value="{!Accounts}" var="acc" rendered="{!acc.size>0}">
    <apex:column headerClass="table-header" headerValue="Name">
       <apex:inputCheckbox value="{!acc.Name}"/>
    </apex:column >
    <apex:column headerValue="CreatedBy" headerClass="table-header">
             {!acc.CreatedById}
     </apex:column>
     <apex:column headerValue="LastModified" headerClass="table-header">
            {!acc.LastModifiedById}
      </apex:column>
 </apex:pageBlockTable>

Thanks,
pRAMODH.

All Answers

Pramodh KumarPramodh Kumar
Here is the small snippet for table header

Let me know if you have any issues.
<style>     
    .table-header{
          text-align:center;
    }
</style>
<apex:pageBlockTable value="{!Accounts}" var="acc" rendered="{!acc.size>0}">
    <apex:column headerClass="table-header" headerValue="Name">
       <apex:inputCheckbox value="{!acc.Name}"/>
    </apex:column >
    <apex:column headerValue="CreatedBy" headerClass="table-header">
             {!acc.CreatedById}
     </apex:column>
     <apex:column headerValue="LastModified" headerClass="table-header">
            {!acc.LastModifiedById}
      </apex:column>
 </apex:pageBlockTable>

Thanks,
pRAMODH.
This was selected as the best answer
SamCousinsSamCousins
Hi pRAMODH, I can get pageBlockTable headers no problem. It's pageblock headers themselves. Thanks, sam