HTML valign attribute
valign
The purpose of the HTML valign attribute is to define the vertical alignment of the 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="middle" >Student Code </th>
<th valign="middle">Percentage of marks</th>
<th valign="middle">Grade</th>
<th valign="middle">Remarks</th>
</tr>
<tr>
<td valign="baseline">S001</td>
<td valign="baseline">92</td>
<td valign="baseline">A+</td>
<td valign="baseline">Excellent</td>
</tr>
<tr>
<td valign="baseline">S002</td>
<td valign="baseline">76</td>
<td valign="baseline">B+</td>
<td valign="baseline">Good</td>
</tr>
</table>
</body>
</html>
Result
View this example in a separate browser window
Example of HTML valign attribute
Previous: HTML usemap attribute
Next: HTML value attribute
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/html/attributes/html-valign-attribute.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics