Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

valign vs text-align in HTML

I can't figure out the difference between valign vs text-align in HTML in context with the following code:

    <table width="500" border="0">
  <tr>
        <td colspan="2" style="background-color:#FFA500;">
   <h1>Main Title of Web Page</h1>
   </td>
      </tr>

  <tr valign="top">
      <td style="background-color:#FFD700;width:100px;text-align:top;">
      <b>Menu</b><br />
    HTML<br />
      CSS<br />
  JavaScript
     </td>
   <td style="background-color:#EEEEEE;height:200px;width:400px;text-align:top;">
      Content goes here</td>
    </tr>

   <tr>
     <td colspan="2" style="background-color:#FFA500;text-align:center;">
     Copyright © 2012</td>
   </tr>
   </table>
like image 729
sandbox Avatar asked Jan 06 '12 11:01

sandbox


1 Answers

valign (html attribute) is equivalent of vertical-align in css

align (html attribute) is equivalent of text-align in css

html attribute versions are deprecated in favour of css

vertical-align positions block elements (e.g. div) vertically inside other block elements

text-align positions inline elements (e.g. span, default text) inside block elements horizontally

like image 190
jenson-button-event Avatar answered Oct 05 '22 10:10

jenson-button-event