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
Kyle York 17Kyle York 17 

Why can't I get my text to align to the right on my VF page?

I need my "text" in this VF to align to the right but it stays to the left. Here is my code:
 
<apex:page controller = "timeStamp_controller" >
	<table style="text-align:right;">
    	   {!NOW()}   
       </table> 
</apex:page>

{!NOW()} is what I need to alighn to the right
Ajay K DubediAjay K Dubedi
Hi Kyle,

I have gone through your issue. First you need to add alignment to your <td> tag (the column) instead of the table.
Secondly, you must give your table some width so that it won't shrink to the size of your content.
Here, I have done it for you - 
 
<apex:page controller = "timeStamp_controller">
    <table width="100%">
        <tr><td style="text-align:center;">
           {!NOW()} 
        </td></tr>
    </table> 
</apex:page>

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
Deepali KulshresthaDeepali Kulshrestha
Hi Kyle,

Please check below code:

<apex:page controller = "timeStamp_controller" >
    <table Width="100%" style="text-align:right;">
           <tr>
              <td>
                   {!NOW()}
              </td>
           </tr>   
       </table> 
</apex:page>


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com