HTML | DOM TableRow align Property

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.

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

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

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


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


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.