I am working with a data table in Visualforce, and I am trying to get the columns with currency values to format similarly to how the account format looks in Excel, where it will align the dollar signs and decimals properly.

enter image description here

I have tried a whole bunch of different options but haven't had any luck. If someone knows of a JavaScript or CSS style class that can achieve this, please let me know!

1 Answer 1


You can place the currency symbol in the first column, and then you can display the currency value (without the currency symbol) in the second column.

The last step would be to remove the border between the two columns and align the text in the second column to the right.


<apex:page id="example" standardController="PricebookEntry" extensions="Example">
    [id="example:price-table"] {
        border-collapse: collapse;
        font-size: 10pt;

    [id="example:price-table"] td {
        border: 1px solid #dadcdd;

    [id^="example:price-table"][id$="currency-symbol"] {
        border-right: 0;

    [id^="example:price-table"][id$="currency-amount"] {
        border-left: 0;
        text-align: right;
    <apex:dataTable id="price-table" value="{!prices}" var="price">
        <apex:column id="currency-symbol">$</apex:column>
        <apex:column id="currency-amount">
            <apex:outputText value="{0, Number, #,###.00}">
                <apex:param value="{!price.UnitPrice}" />


enter image description here


You must log in to answer this question.

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