css text align top code example

Example 1: text align left top

td[rowspan] {
  vertical-align: top;
  text-align: left;
}

Example 2: css vertical align

.top-align {
	vertical-align: top;
}  

.center-align {
  	vertical-align: middle;
}

Example 3: text vertical align css

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style type="text/css">
      div {
        display: table-cell;
        width: 250px;
        height: 200px;
        vertical-align: middle;
      }
    </style>
  </head>
  <body>
    <div>Vertically aligned text</div>
  </body>
</html>

Example 4: text align left top

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid black;
}
</style>
</head>
<body>

<table style="width:50%;">
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
    <tr style="height:100px">
      <td valign="top">January</td>
      <td valign="bottom">$100</td>
    </tr>
</table>

<p><b>Note:</b> The valign attribute is not supported in HTML5. Use CSS instead.</p>

</body>
</html>

Tags:

Css Example