HTML Element Style How to - Position text to the top of table cell td








Question

We would like to know how to position text to the top of table cell td.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
td.topped {<!--from w  ww  . jav a 2 s .  c  o  m-->
  vertical-align: top;
}
</style>
</head>
<body>
  <table>
    <tr>
      <td rowspan="2" class="topped">in vertical top</td>
      <td>s0me</td>
    </tr>
    <tr>
      <td>t3xt</td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: