Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML valign Attribute

  • Last Updated : 30 Sep, 2021

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:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

<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.

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



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!