Jump to content


Photo

Text-align


  • Please log in to reply
4 replies to this topic

#1 otuatail

otuatail
  • Members
  • PipPipPip
  • Advanced Member
  • 956 posts

Posted 17 February 2017 - 10:41 AM

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?>">&nbsp;/&nbsp; 
               <input style="text-align:right;" type="text" size="1" maxlength="2" name="MM_Entry" value="<?=$SE_MM_Entry?>">&nbsp;/&nbsp;
               <input style="text-align:right;" type="text" size="2" maxlength="4" name="YYYY_Entry" value="<?=$SE_YYYY_Entry?>">&nbsp;
               <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:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&pound;
            <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:&nbsp;&nbsp;&pound;
            <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>     



#2 requinix

requinix
  • Administrators
  • Lazy Administrator
  • 9,255 posts
  • LocationWA

Posted 17 February 2017 - 10:44 AM

text-align is CSS. You can't just take a CSS thing and make it an HTML thing.
The Reimann Zeta Function Trolley Problem | "Summer is when I, the great ice fairy, can show my true power!"

#3 otuatail

otuatail
  • Members
  • PipPipPip
  • Advanced Member
  • 956 posts

Posted 17 February 2017 - 11:30 AM

Ok so there is a solution?



#4 requinix

requinix
  • Administrators
  • Lazy Administrator
  • 9,255 posts
  • LocationWA

Posted 17 February 2017 - 12:21 PM

You already know what the solution is:

Seems this only works within a style"text-align:right"


The Reimann Zeta Function Trolley Problem | "Summer is when I, the great ice fairy, can show my true power!"

#5 Stielle

Stielle
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 07 April 2017 - 01:45 PM

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;".
 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users