How do I align text in "top right"?

51,958
<table>
    <tr>
        <td align="right" style="vertical-align: top;">
            <b>Car Name:</b>
        </td>
        <td>
            <div><%=Model.DataMayLoad1%></div>
            <div><%=Model.DataMayLoad2%></div> 
            <div><%=Model.DataMayLoad3%></div>
            <div><%=Model.DataMayLoad4%></div>
        </td>
    </tr>
</table>
Share:
51,958

Related videos on Youtube

MrM
Author by

MrM

Updated on July 09, 2022

Comments

  • MrM
    MrM almost 2 years

    I have the following table.

    <table>
        <tr>
            <td align="right">
                <b>Car Name:</b>
            </td>
            <td>
                <div><%=Model.DataMayLoad1%></div>
                <div><%=Model.DataMayLoad2%></div> 
                <div><%=Model.DataMayLoad3%></div>
                <div><%=Model.DataMayLoad4%></div>
            </td>
        </tr>
    </table>
    

    The "Car Name:" column is right aligned, but in the center. Is there a way to align that column to the top right corner?

    • Darin Dimitrov
      Darin Dimitrov almost 13 years
      Just a side note concerning the XSS vulnerability that your site is exposed to by using <%= Model.SomePropertyName %>. So while you worry about aligning columns you have far bigger problems with your code.
    • Dismissile
      Dismissile almost 13 years
      If you use <%: %> it will HtmlEncode the content. So you probably want to use that in its place.
    • MrM
      MrM almost 13 years
      THanks for the help. Would <%: %> help in the cross site scripting vulnerability?
  • Chris Cudmore
    Chris Cudmore almost 13 years
    deprecated.. Use PaulPRO's solution