Does anyone know how to get a visualforce page to have text span across 2 columns? I know the command in HTML would be a colspan command, but I have not been able to find the equivalent in Visualforce. Any help would be appreciated.

  • 1
    In what kind of HTML element? A table column? – Mike Chale Nov 18 '13 at 19:43

Assuming you want to do this in a table, you would use the colspan attribute of <apex:column>. Quoting from the documentation, colspan represents:

The number of columns that this column spans in the table. Note that this value does not apply to the header and footer cells.


<apex:datatable value="{! myList}" var="item">
  <apex:column colspan=2 value="{!item.column}"/>

Note: Keep in mind that you can always apply custom CSS and classes to the apex controls.

  • Is there anything I can use with apex:panelgrid? I would have to complete gut my page if I were changing to apex:datatable. – user2569499 Nov 25 '13 at 15:21
  • Not that I'm aware of and CSS doesn't do colspan. – Mike Chale Nov 25 '13 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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