HTML valign Attribute
The HTML valign attribute is used to specify the vertical alignment of the text in the element. This attribute supports many table-related elements such as <tr>,<td>,<tbody>,<col>, and <tfoot>.
Note: The valign attribute is not supported by HTML5.
Syntax:
<element valign="top | middle | bottom | baseline">
Attribute value:
Attribute Value | Description |
---|---|
top | Sets the content to top-align. |
middle | Sets the content to middle-align. |
bottom | Sets the content to bottom-align. |
baseline | Sets the content to baseline-align. The baseline is the line where most of the characters sit in the table data element. |
Example: This example illustrates the use of valign attribute in the HTML document.
HTML
<!DOCTYPE html> < html > < head > < title > HTML valign Attribute in < td > element </ title > </ head > < body > < h1 >w3wiki</ h1 > < h2 >HTML valign Attribute in Table Data Element</ h2 > < table border = "1" width = "500" > < tr > < th >NAME</ th > < th >ID</ th > < th >AGE</ th > </ tr > < tr style = "height:50px;" > < td valign = "top" >BITTU</ td > < td valign = "center" >123</ td > < td valign = "bottom" >21</ td > </ tr > < tr style = "height:50px;" > < td valign = "bottom" >RAKESH</ td > < td valign = "center" >124</ td > < td valign = "top" >24</ td > </ tr > </ table > </ body > </ html > |
Output:
Supported Browsers:
- Google Chrome 1
- Edge 12
- Firefox 1
- Safari 4
- Opera 1
Contact Us