HTML | Align Attribute - GeeksforGeeks

Skip to content geeksforgeeks
  • Courses
    • DSA Courses
    • Programming Languages
  • Tutorials
    • Python Tutorial
      • Python Loops and Control Flow
    • Java
      • Java Interview Questions
      • Java Quiz
      • Advance Java
    • Programming Languages
    • System Design
    • Interview Corner
    • Computer Science Subjects
    • DevOps
    • Linux
    • Software Testing
    • Databases
    • Android
    • Excel
    • Mathematics
  • DSA
    • Data Structures
    • Algorithms
      • Analysis of Algorithms
      • Searching Algorithms
      • Sorting Algorithms
    • Practice
      • Company Wise Coding Practice
      • Practice Problems Difficulty Wise
      • Language Wise Coding Practice
      • Curated DSA Lists
    • Company Wise SDE Sheets
    • DSA Cheat Sheets
    • Puzzles
  • Data Science
    • Data Science Packages
    • Data Visualization
    • Data Analysis
  • Web Tech
    • Web Development Using Python
      • Django
      • Flask
    • Cheat Sheets
  • HTML Tutorial
  • HTML Exercises
  • HTML Tags
  • HTML Attributes
  • Global Attributes
  • Event Attributes
  • HTML Interview Questions
  • HTML DOM
  • DOM Audio/Video
  • HTML 5
  • HTML Examples
  • Color Picker
  • A to Z Guide
  • HTML Formatter
Open In App HTML <td> align Attribute Last Updated : 22 Dec, 2023 Summarize Comments Improve Suggest changes Like Article Like Save Share Report Follow

The HTML <td> align attribute is used to set the horizontal alignment of text content. It uses the align attribute in HTML <td> to horizontally align text content within a table cell and it sets “left,” “center,” or “right” to control horizontal alignment.

Note: The <td> align attribute is not supported by HTML5 instead uses CSS.

Syntax:

<td align ="left | right | center | justify | char ">

Attribute Values:

The <td> align attributes have the following attributes which are as:

Attributes

Description

left

It sets the text left-aligned of a container.

right

It sets the text right-align of the container.

center

It sets the text center-align.

justify

It stretches the text of paragraph to set the width of all lines equal.

char

It sets the text-align to a specific character.

Example:

In this example, we will see the implementation of the <td> align tag with an example.

html

<!DOCTYPE html> <html> <head> <title> HTML td align Attribute </title> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML td align Attribute</h2> <table width="500" border="1"> <tr> <th>NAME</th> <th>AGE</th> <th>BRANCH</th> </tr> <tr> <td align="center">BITTU</td> <td align="left">22</td> <td align="right">CSE</td> </tr> <tr> <td align="center">RAKESH</td> <td align="left">25</td> <td align="right">EC</td> </tr> </table> </body> </html>

Output:

tdalign

Example:

In this example, we will see the implementation of the <td> align tag with another example.

HTML

<!DOCTYPE html> <html> <head> <title> HTML td align Attribute </title> <style> h1, h2 { text-align: center; color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML td align Attribute</h2> <table width="500" border="1"> <tr> <th>NAME</th> <th>AGE</th> <th>BRANCH</th> </tr> <tr> <td style="text-align: center;">BITTU</td> <td style="text-align: left;">22</td> <td style="text-align: right;">CSE</td> </tr> <tr> <td style="text-align: left;">RAKESH</td> <td style="text-align: center;">25</td> <td style="text-align: left;">EC</td> </tr> </table> </body> </html>

Output:

Screenshot-2023-12-05-152510

Output

Supported Browsers:

  • Google Chrome 1 and above
  • Microsoft Edge 12 and above
  • Firefox 1 and above
  • Opera 12.1 and above
  • Safari 1 and above

HTML is the foundation of webpages, is used for webpage development by structuring websites and web apps.You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.

Comment More info Next Article HTML <tr> align Attribute author jit_t Follow Improve Article Tags :
  • HTML
  • Web Technologies
  • HTML-Attributes

Similar Reads

  • HTML <td> align Attribute The HTML <td> align attribute is used to set the horizontal alignment of text content. It uses the align attribute in HTML <td> to horizontally align text content within a table cell and it sets "left," "center," or "right" to control horizontal alignment. Note: The <td> align attr 2 min read
  • HTML <tr> align Attribute The HTML <tr> align Attribute is used to set the horizontal alignment of text content inside the table row. The HTML <tr> element itself doesn't have an align attribute. For aligning content within a table row, use the CSS text-align property on the individual <td> or <th> el 1 min read
  • HTML <th> align Attribute The HTML <th> align Attribute is used to set the horizontal alignment of text content inside the table header cell. Instead, use CSS for alignment properties such as text-align to specify the horizontal alignment and vertical-align for vertical alignment within table headers. Note: The align a 2 min read
  • HTML | <tbody> align Attribute The HTML <tbody> align Attribute is used to set the horizontal alignment of text content inside the table body (tbody). Syntax: <tbody align="left | right | center | justify | char"> Attribute Value: left: It sets the text left-align. right: It sets the text right-align. center: It sets 1 min read
  • HTML | <thead> align Attribute The HTML <thead> align attribute is used to set the horizontal alignment of text content inside the table head (thead) section. Syntax: <thead align="left|right|center|justify|char"> Note: This attribute has been DEPRECATED and is no longer recommended. Attribute Value: left: It sets the 1 min read
  • HTML <p> align Attribute The HTML <p> tag is used to define paragraphs of text. In earlier versions of HTML, the align attribute was used to control the horizontal alignment of paragraph content. However, the align attribute for the <p> tag is deprecated in HTML5. Today, developers are encouraged to use CSS for 3 min read
  • HTML <table> align Attribute The HTML <table> align Attribute is used to specify the alignment of the table and its content. Instead of the align attribute, CSS properties like margin and text-align are preferred for table alignment. For aligning content within table rows or cells, use the align attribute within <tr 2 min read
  • HTML | <tfoot> align Attribute The HTML <tfoot> align Attribute is used to set the horizontal alignment of text content inside the table footer (tfoot). It is not supported by HTML 5. Syntax: <tfoot align="left | right | center | justify | char"> Attribute Value: left: It sets the table footer text left-align. right: 1 min read
  • HTML | <object> align Attribute The HTML <object> align Attribute is used to specify an alignment for an object Element. It is an inline element means that can not insert a new line on a page. The text and other elements can also wrap around it. Note: This attribute is not supported by HTML5. Syntax: <object align="left | 1 min read
  • HTML <input> align Attribute The HTML <input> align attribute is used with <input type=” image”> to set the horizontal alignment of the image. It is not supported by HTML 5. Note: Since <input type=” image”> is not supported by HTML5 you can use CSS there instead of this attribute. The syntax for CSS <input 1 min read
  • HTML <hr> align Attribute The HTML <hr> align Attribute is used to specify the alignment of the horizontal line. If the width attribute is not set to 100% then the align attribute will not create any effect. Note: The <hr> align Attribute is not supported by HTML5. Syntax: <hr align="left | center | right"> 1 min read
  • HTML | <col> align Attribute The HTML <col> align Attribute is used to set the horizontal alignment of text content inside the col element. It is not supported by HTML 5. Syntax: <col align="left | right | center | justify | char"> Attribute Values: left: It sets the text left-align. right: It sets the text right-al 1 min read
  • HTML <div> align Attribute The HTML <div> align attribute was used to specify the horizontal alignment of content within a <div> element. However, this attribute is no longer supported in HTML5. Today, we use CSS for alignment purposes. Note: This attribute is not supported by HTML5. Syntax<div align="left | ri 3 min read
  • HTML <img> align Attribute The HTML <img> align attribute sets an image's alignment relative to surrounding elements, allowing horizontal or vertical positioning. It is deprecated in HTML5 and replaced by CSS properties like float and vertical alignment for more flexible and modern alignment options. Note: The align att 3 min read
  • HTML | <td> abbr Attribute The HTML <td> abbr attribute is used to specify the shorter version of the content. This attribute is not supported by HTML 5. It does not describe any visual effect but it is used by screen readers. Syntax: <td abbr="text"> Attribute Values: text: It contains the short description of ce 1 min read
  • HTML | <legend> align Attribute The <legend> align attribute in HTML is used to specify the alignment of the caption in a <fieldset> element. The left and right alignment of <legend> element are supported by major browsers except Opera 12 and earlier versions. The bottom alignment are not supported by any browser 2 min read
  • HTML <iframe> align Attribute The HTML <iframe> align attribute is used to specify the alignment of the inline-frame according to the alternate element. Syntax <iframe align="left|right|middle|top|bottom"> Attribute Values left: It sets the alignment of an iframe to left.right: It sets the alignment of an iframe to r 1 min read
  • HTML | <th> abbr Attribute The HTML <th> abbr Attribute is used to specify the shorter version of content in header cell. It does not describe any visual effect but it is used by screen readers. Syntax: <th abbr="text"> Attribute Values: text: It contains the short description of header cell content. Example: C/C+ 1 min read
  • HTML | <caption> align Attribute The HTML <caption> align Attribute is used to specify the alignment of the <caption> Element. It is used to align the caption to the left, right, top and Bottom of a table. This attribute is not supported in HTML5. Note: By default , the table caption is aligned to center. Syntax: <ca 2 min read
Like three90RightbarBannerImg Explore More We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy Got It ! Lightbox Improvement Suggest changes Suggest Changes Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal. geeksforgeeks-suggest-icon Create Improvement Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all. geeksforgeeks-improvement-icon Suggest Changes min 4 words, max CharLimit:2000

What kind of Experience do you want to share?

Interview Experiences Admission Experiences Career Journeys Work Experiences Campus Experiences Competitive Exam Experiences

Từ khóa » Html Column Align Right