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

PageBlockSection content alignment



I have a pageBlockSection with columns = 4.  I am trying to display data in this pageBlockSection using apex:outputField:


  <apex:pageBlockSection title="GC Report" columns="4">
                <apex:outputField value="{!Result__c.GC_AGE_USED__c}" />
                <apex:outputtext value="" />
                <apex:outputtext value="" />
                <apex:outputtext value="" />
                <apex:outputField value="{!Result__c.INCOME_USED__c}" />
                <apex:outputField value="{!Result__c.Total_Income__c}" />
                <apex:outputField value="{!Result__c.IncomeSRI__c}" />       
                <apex:outputField value="{!Result__c.INCOME__c}" />
                <apex:outputField value="{!Result__c.REALESTATE_USED__c}" />
                <apex:outputField value="{!Result__c.RealEstate_Total__c}" />
                <apex:outputField value="{!Result__c.RealEstateSRI__c}" />       
                <apex:outputField value="{!Result__c.REALESTATE__c}" />



The data is not aligned properly.. The first two columns take up majority of the display space and the last two appear crowded.  Why is this?





This is due to the salesforce standardStyleSheet. From the component reference for pageBlockSection:


"While you can specify one or more columns for a pageBlockSection, Salesforce stylesheets are optimized for either one or two columns."


If you're going to use pageBlockSections with more than two columns, I'd suggest using your own stylesheet via the <apex:stylesheet> tag.