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
Chris110Chris110 

How to make the content centered outputLabel

 

<apex:outputLabel style="">
              <apex:commandButton action="{!add}" value="add"/>
              <apex:commandButton value="Search" action="{!Searchs}" onclick="return SearchClick()"/>
              </apex:outputLabel>

 use css styles like this

 

 <table width="100%">
                  <tr>
                      <td align="center">
                          <apex:commandButton action="{!add}" value="add"/>
                          <apex:commandButton value="Search" action="{!Searchs}" onclick="return SearchClick()"/>
                      </td>
                  </tr>
              </table>

 thanks for your help!

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
SSRS2SSRS2

>>I know the "pageBlockButtons",it will be Displays two buttons.

  No you have an attribute called location try with this attribute.Put location is top or bottom.

 

  <apex:pageBlockButtons location="top"><!--"top", "bottom", or "both".-->

-Suresh

All Answers

rmehrmeh

Hi

 

try this out

 

<apex:outputLabel style="text-align:center">
Pradeep_NavatarPradeep_Navatar

You can put your code in <div> tag for better look and feel :

 

<div style="text-align:center">

// put your code here.

</div>

 

Hope this helps.

SSRS2SSRS2

Why do you try with outputLabel?I think better to put command buttons whithin output panel or apex:pageBlockButtons. 

 <apex:outputPanel style="text-align:center" layout="block">
              <apex:commandButton action="{!add}" value="add"/>
              <apex:commandButton value="Search" action="{!Searchs}" onclick="return SearchClick()"/>
</apex:outputPanel>

or

 

<apex:pageBlock>
  <apex:pageBlockButtons location="top">
              <apex:commandButton action="{!add}" value="add"/>
              <apex:commandButton value="Search" action="{!Searchs}" onclick="return SearchClick()"/>
  </apex:pageBlockButtons>
</apex:pageBlock>

 -Suresh

 

Chris110Chris110

Thanks for your help!

But it's not work!

 

<apex:outputLabel style="text-align:center">
              <apex:commandButton action="{!add}" value="add"/>
          </apex:outputLabel>

 

 

Chris110Chris110

Use pageBlockButtons,I know this way.

But I just want to let the button once,pageBlockButtons will appear button twice.

You have tried "text-align: center" .

Why dose it not work  in IE, Firefox, Google Chrome in my computer.

Chris110Chris110

I know the "pageBlockButtons",it will be Displays two buttons.

Do you have try

text-align:center

I can not understand so many people are used it.

But it can not work in iE ,firefox ,Google Chrome in my computer.

 

SSRS2SSRS2

>>I know the "pageBlockButtons",it will be Displays two buttons.

  No you have an attribute called location try with this attribute.Put location is top or bottom.

 

  <apex:pageBlockButtons location="top"><!--"top", "bottom", or "both".-->

-Suresh

This was selected as the best answer
Chris110Chris110

It is the effect I want.

Thanks