HTML <td> valign Attribute
Last Updated :
28 Dec, 2023
The HTML <td> valign Attribute is used to specify the vertical alignment of text content in a cell. It accepts several values such as “top,” “middle,” “bottom,” and “baseline” to specify the vertical alignment. If not explicitly set, the content in a table cell is vertically aligned to the middle by default.
Note:Â The <td> valign Attribute is not supported by HTML5.
Syntax:
<td valign="top | middle | bottom | baseline">
Supported Tags:
Attribute Value:
top
|
It sets the content to top-align.
|
middle
|
It sets the content to middle-align.
|
bottom
|
It sets the content to bottom-align.
|
baseline
|
It sets the content to baseline. The baseline is the line where most of the characters sit. It is a default value.
|
Example: In this example we will see the implementation of above td valign tag with an example.
html
<!DOCTYPE html>
< html >
< head >
< title >
HTML td valign Attribute
</ title >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 >HTML td valign Attribute</ h2 >
< table border = "1" width = "500" >
< tr >
< th >NAME</ th >
< th >AGE</ th >
< th >BRANCH</ th >
</ tr >
< tr style = "height:50px;" >
< td valign = "top" >BITTU</ td >
< td valign = "center" >22</ td >
< td valign = "bottom" >CSE</ td >
</ tr >
< tr style = "height:50px;" >
< td valign = "bottom" >RAKESH</ td >
< td valign = "center" >25</ td >
< td valign = "top" >EC</ td >
</ tr >
</ table >
</ body >
</ html >
|
Output:
Supported Browsers:
- Google Chrome 1
- Microsoft Edge 12
- Firefox 1
- Opera 12.1
- Safari 1
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...