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.
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 >w3wiki</ 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:
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 >w3wiki</ 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:
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.
Contact Us