Skip to content
Related Articles

Related Articles

Improve Article

HTML | DOM TableRow align Property

  • Last Updated : 30 Dec, 2019

The HTML DOM TableRow align Property is used to set or return the horizontal alignment of the content within the table row. It is not supported by HTML 5.

Syntax:

  • It returns the align property.
    TableRowobject.align
  • It sets the align property.
    TableRowObject.align = "left | right | center"

Property Values:

  • left: It sets the left-align to TableRow.
  • center: It sets the center-align to TableRow. It is the default value.
  • right: It sets the right-align to TableRow.

Return Values: It returns a string value which represents the alignment of the TableRow element.

Example 1: This example sets the TableRow align Property.






<!DOCTYPE html> 
<html
      
<head
    <style
        table, th, td { 
            border: 1px solid green; 
        
    </style
</head
  
<body
  
    <h1
        GeeksForGeeks 
    </h1
          
    <h2>HTML DOM tableRow align Property</h2
  
    <table
        <tr id = "GFG" align = "left"
            <td>Geeks</td
            <td>Geeks</td
            <td>For</td
            <td>Geeks</td
        </tr
    </table
  
    <button onclick = "myGeeks()"
        Click Here! 
    </button
    <p id ="sudo"></p>
      
    <script
        function myGeeks() { 
            var row = document.getElementById("GFG").align; 
            document.getElementById("sudo").innerHTML = row; 
        
    </script
</body
  
</html>                     

Output:

  • Before Clicking On Button:
  • After Clicking On Button:

Example 2:




<!DOCTYPE html> 
<html
      
<head
    <style
        table, th, td { 
            border: 1px solid green; 
        
    </style
</head
  
<body
    <h1
        GeeksForGeeks 
    </h1
          
    <h2>HTML DOM tableRow align Property</h2
  
    <table
        <tr id = "GFG" align = "left"
            <td>Geeks</td
            <td>Geeks</td
            <td>For</td
            <td>Geeks</td
        </tr
    </table
  
    <button onclick = "myGeeks()"
        Click Here! 
    </button
    <p id ="sudo"></p>
      
  
    <script
        function myGeeks() { 
            var row = document.getElementById("GFG").align = "right"; 
            document.getElementById("sudo").innerHTML = 
                        "The value was changed to  " + row;
        
    </script
</body
  
</html>

Output:

  • Before Clicking On Button:
  • After Clicking On Button:

Supported Browsers: The browsers supported by DOM TableRow align Property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

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




My Personal Notes arrow_drop_up
Recommended Articles
Page :