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.
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook