Jump to content

Recommended Posts

Hi, I want to align text within a text input box. Seems this only works within a style"text-align:right" statement but not within the <input> statement.

        <div style="width:450px;height:230px;padding:10px;"> 	
           <div style="width:240px;height:30px;float:left;">
               <div style="width:440px;float:left;">Entry Date:
               <input style="text-align:right;" type="text" size="1" maxlength="2" name="DD_Entry" value="<?=$SE_DD_Entry?>"> /  
               <input style="text-align:right;" type="text" size="1" maxlength="2" name="MM_Entry" value="<?=$SE_MM_Entry?>"> / 
               <input style="text-align:right;" type="text" size="2" maxlength="4" name="YYYY_Entry" value="<?=$SE_YYYY_Entry?>"> 
               <span style="color:red;"><?=$_SESSION['Error_5']?></span></div>
            </div>       

This doesn't work

            <div style="width:220px;height:30px;float:left;clear:both">Money in:     £
            <input type="text" maxlength="10" size="5" name="MoneyIn" text-align="right" value="<?=$SE_Money_In?>" size="8">
            <span style="color:red;"><?=$_SESSION['Error_6']?></span></div>
    
            <div style="width:220px;height:30px;float:left;clear:both">Money Out:  £
            <input type="text" maxlength="10" size="5" name="MoneyOut" text-align="right" value="<?=$SE_Money_Out?>" size="8">
            <span style="color:red;"><?=$_SESSION['Error_7']?></span></div>     

Link to comment
https://forums.phpfreaks.com/topic/303215-text-align/
Share on other sites

  • 1 month later...

Some tags (like <div> and <p>) have their own 'align' (not text-align) attribute, but <input> is not one of them. This is why your code does not work in the <input> tag directly.

You want to use CSS for alignment, so you just have to set it up in as you did with style="text-align:right;".
 

Link to comment
https://forums.phpfreaks.com/topic/303215-text-align/#findComment-1545143
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.