HTML <TD> valign Attribute

The TD valign attribute vertical align the data of table cell, the data in table cell can be aligned center, top, bottom and baseline. The valign tag is supported by major browsers which include Internet explorer, firefox, chrome and opera.

HTML code of table with different vertical alignments of cell data.

   1:  <html>
   2:  <head>
   3:  <title>
   4:  TR valign attribute
   5:  </title>
   6:  </head>
   7:  <body>
   8:  <table border="1" style="height:200px">
   9:  <tr>
  10:  <td valign="top">
  11:  Top Alignment
  12:  </td>
  13:  <td>
  14:  Default Alignment
  15:  </td>
  16:  </tr>
  17:  <tr>
  18:  <td valign="center">
  19:  CenterAlignment
  20:  </td>
  21:  <td>
  22:  Default Alignment
  23:  </td>
  24:  </tr>
  25:  <tr>
  26:  <td valign="bottom">
  27:  Bottom Alignment
  28:  </td>
  29:  <td>
  30:  Default Alignment
  31:  </td>
  32:  </tr>
  33:  <tr>
  34:  <td valign="baseline">
  35:  Baseline Alignment
  36:  </td>
  37:  <td>
  38:  Default Alignment
  39:  </td>
  40:  </tr>
  41:  </table>
  42:  </body>
  43:  </html>
 
  

The following output will be shown on browser.

image

Tags: , , , ,

Author: Revo

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *

one × 1 =

 

Pin It on Pinterest

Shares
Share This