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>.
Syntax:
<element valign="top | middle | bottom | baseline">
Attribute value:
- top: It sets the content to the top-align.
- middle: It sets the content to the middle-align.
- bottom: It sets the content to the bottom-align.
- baseline: It sets the content to baseline. The baseline is the line where most of the characters sit in the table data element.
Note: The valign attribute is not supported by HTML 5.
Example: Below code 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 >GeeksforGeeks</ 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
- Internet Explorer
- Firefox
- Safari
- Opera
Please Login to comment...