[SalesForce] column width for pageBlockSection

So I am using a pageBlockSection with two columns to display some details for particular SObjects. The first column would hold a label and the second column would hold the value for that particular label. Here is a picture to illustrate this:
enter image description here

So I am aligning the items in column 1 to the right and the items in column 2 to the left so that they look close to each other but have the same spacing between them. However as you can see there is a large amount of whitespace to the left of the labels (created date, start date, etc) and some of the values have to wrap around due to their length. So I would like to shorten the width of the first column and extend the length of the second. Any ideas on how to implement this?

Best Answer

Hi I ran into this challenge and was able to solve it with width percentages. Check out my example below.

<apex:pageBlockSectionItem dataStyle="width:10%" labelStyle="width:23%" >
<apex:outputLabel >Field 2</apex:outputLabel>
<apex:inputField value="{!obj__c.field2}" style="width:80px"/>
</apex:pageBlockSectionItem>
Related Topic