Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I have a pageblocksection with 4 columns where the spacing between 3rd and 4th is not equal.How to fix the spacing between columns.

<apex:page standardController="Account">
   <apex:form >
      <apex:pageBlock title="My Block"> 
           <apex:pageBlockSection title="My Section" columns="4" collapsible="false">
                <apex:outputField value="{!Account.Field1__c}"/>
                <apex:outputField value="{!Account.Field2__c}"/>
                <apex:outputField value="{!Account.Field3__c}"/>
                <apex:outputField value="{!Account.Field4__c}"/>
                <apex:outputField value="{!Account.Field5__c}"/>
                <apex:outputField value="{!Account.Field6__c}"/>
                <apex:outputField value="{!Account.Field7__c}"/>
                <apex:outputField value="{!Account.Field8__c}"/>
              </apex:pageBlockSection> 
         </apex:pageBlock> 
  </apex:form>

share|improve this question

2 Answers 2

up vote 6 down vote accepted

You'll find that it's not recommended to use PageBlockSection with more than two columns. You may be better off writing your own HTML as you'll be able to style it more precisely.

"Salesforce stylesheets are optimized for either one or two columns." ( https://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_pageBlockSection.htm )

share|improve this answer

Thanks @mrBlaQ.Here is my solution.

<apex:page standardController="Account">
   <apex:form >
        <table width="100%">
               <tr>
                <td>
                <apex:outputLabel value="Field1" style="font-weight:bold"/>
                &nbsp;&nbsp;
                <apex:outputField value="{!Account.Field1__c}"/>
                </td>
                <td>
                <apex:outputLabel value="Field2" style="font-weight:bold"/>
                &nbsp;&nbsp;
                 <apex:outputField value="{!Account.Field2__c}"/>
                </td>
                <td>
                <apex:outputLabel value="Field3" style="font-weight:bold"/>
                &nbsp;&nbsp;
                <apex:outputField value="{!Account.Field3__c}"/>
                </td>
                <td>
                <apex:outputLabel value="Field4" style="font-weight:bold"/>
                &nbsp;&nbsp;
                <apex:outputField value="{!Account.Field4__c}"/>
                </td>
               </tr>
               <tr>
               <td>
               <apex:outputLabel value="Field5" style="font-weight:bold"/>
                &nbsp;&nbsp;
                <apex:outputField value="{!Account.Field5__c}"/>
                </td>
                <td>
                <apex:outputLabel value="Field6" style="font-weight:bold"/>
                &nbsp;&nbsp;
                 <apex:outputField value="{!Account.Field6__c}"/>
                </td>
                <td>
                <apex:outputLabel value="Field7" style="font-weight:bold"/>
                &nbsp;&nbsp;
                <apex:outputField value="{!Account.Field7__c}"/>
                </td>
                <td>
                <apex:outputLabel value="Field8" style="font-weight:bold"/>
                &nbsp;&nbsp;
                <apex:outputField value="{!Account.Field8__c}"/>
                </td>
               </tr>
              </table> 
          </apex:form> 
 </apex:page>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.