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> Quote Link to comment https://forums.phpfreaks.com/topic/303215-text-align/ 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. Quote Link to comment https://forums.phpfreaks.com/topic/303215-text-align/#findComment-1542893 Share on other sites More sharing options...
otuatail Posted February 17, 2017 Author Share Posted February 17, 2017 Ok so there is a solution? Quote Link to comment https://forums.phpfreaks.com/topic/303215-text-align/#findComment-1542895 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" Quote Link to comment https://forums.phpfreaks.com/topic/303215-text-align/#findComment-1542906 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;". Quote Link to comment https://forums.phpfreaks.com/topic/303215-text-align/#findComment-1545143 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.