otuatail Posted February 17, 2017 Share Posted February 17, 2017 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 Share on other sites More sharing options...
requinix Posted February 17, 2017 Share Posted February 17, 2017 text-align is CSS. You can't just take a CSS thing and make it an HTML thing. Link to comment Share on other sites More sharing options...
otuatail Posted February 17, 2017 Author Share Posted February 17, 2017 Ok so there is a solution? Link to comment Share on other sites More sharing options...
requinix Posted February 17, 2017 Share Posted February 17, 2017 You already know what the solution is: Seems this only works within a style"text-align:right" Link to comment Share on other sites More sharing options...
Stielle Posted April 7, 2017 Share Posted April 7, 2017 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 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.