Click here to Skip to main content
15,796,738 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am trying to align &hearts to the right and it doesnt seem to be working

see code below

Any ideas?

What I have tried:

if(isset($arr['BoysName'][$i])) { echo '<td>'.$arr['BoysName'][$i].'<align="right"> ♥</td>'; }else{ echo '<td> </td>'; }
if(isset($arr['GirlsName'][$i])) { echo '<td>'.$arr['GirlsName'][$i].' ♥</td>'; }else{ echo '<td> </td>'; }
echo '</tr>';
Updated 10-Feb-18 2:17am

1 solution

You have to specify the align attribute within a tag because it is an attribute and not a tag. But the align attribute is deprecated. Use CSS styles instead:
echo '<td>'.$arr['BoysName'][$i].'<div style="text-align:right;float:right;"> ♥</div></td>';
The float:right style is necessary to avoid line breaks. It should be sufficient to use only that style and omit the text-align.
Share this answer
Member 13637584 10-Feb-18 7:19am    
great, that worked! many thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900