HTML valign attribute
Description
Purpose of the HTML valign attribute is to define the vertical alignment of content of a table cell.
Supported elements
HTML valign attribute supports col, colgroup, tbody, td, tfoot, th, thead, tr elements.
Syntax
<ElementName valign="value" >.....</ElementName>
Where ElementName is any supported element.
Type of value
Predefined.
Default value
| Value | Description |
|---|---|
| top | Sets the vertical alignment of cell content top. |
| middle | Sets the vertical alignment of cell content center. |
| bottom | Sets the vertical alignment of cell content bottom. |
| baseline | If set, the first text line occurs on a baseline common to all cells in the row. |
Supported doctypes
HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.
Example of HTML valign attribute
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Example of HTML valign attribute with td element </title> </head> <body> <table width="200" border="1" cellpadding="2"> <tr> <th valign="center" >Student Code </th> <th valign="center">Percentage of marks</th> <th valign="center">Grade</th> <th valign="center">Remarks</th> <tr> <td valign="baseline">S001</td> <td valign="baseline">92</td> <td valign="baseline">A+</td> <td valign="baseline">Excellent</td> <tr> <td valign="baseline">S002</td> <td valign="baseline">76</td> <td valign="baseline">B+</td> <td valign="baseline">Good</td> </table> </body> </html>
Result


