What Does Tr Stand for in Html
HTML: <tr> tag
This HTML tutorial explains how to use the HTML element called the <tr> tag with syntax and examples.
Description
The HTML <tr> tag defines a row in an HTML table. Each <tr> tag can contain one or more <th> tags that define header cells in the table or one or more <td> tags that define standard cells in the table. This tag is also commonly referred to as the <tr> element.
Syntax
In HTML, the syntax for the <tr> tag is: (example of a table with 2 columns and 4 rows)
<body> <table> <tr> <th>Item</th> <th>Amount</th> </tr> <tr> <td>Grapes</td> <td>$18</td> </tr> <tr> <td>Apples</td> <td>$4</td> </tr> <tr> <td>Pears</td> <td>$7</td> </tr> </table> </body>
Sample Output
Attributes
In addition to the Global Attributes, the following is a list of attributes that are specific to the <tr> tag:
Attribute | Description | HTML Compatibility |
---|---|---|
align | Horizontal alignment of text in each cell within the row. It can be one of the following values: left, center, right, justify, char | Deprecated in HTML 4.01, Obsolete in HTML5, use CSS |
bgcolor | Background color of each cell within a row | Deprecated in HTML 4.01, Obsolete in HTML5, use CSS |
char | Set the character to align the cells in a column | Deprecated in HTML 4.01, Obsolete in HTML5 |
charoff | Number of characters to offset column data from the alignment characters (in char attribute) | Deprecated in HTML 4.01, Obsolete in HTML5 |
valign | Vertical alignment of text of each cell within a row. It can be one of the following values: baseline, bottom, middle, top | Deprecated in HTML 4.01, Obsolete in HTML5, use CSS |
Note
- The HTML <tr> element is found in an HTML table within the <body> tag.
- The <tr> tag is made up of one or more <th> or <td> tags.
- The <tr> tag defines the table rows. There must be at least one row in the table.
- The <th> tag defines the header cells in the table which are displayed as bold, center-aligned text.
- The <td> tag defines the standard cells in the table which are displayed as normal-weight, left-aligned text.
Browser Compatibility
The <tr> tag is compatible with the following browsers:
- Chrome
- Android
- Firefox (Gecko)
- Firefox Mobile (Gecko)
- Internet Explorer (IE)
- Edge Mobile
- Opera
- Opera Mobile
- Safari (WebKit)
- Safari Mobile
Example
We will discuss the <tr> tag below, exploring examples of how to use the <tr> tag in HTML5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.
- HTML5
- HTML4
- XHTML
HTML5 Document
If you created a new web page in HTML5, your <tr> tag might look like this:
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>HTML5 Example by www.techonthenet.com</title> </head> <body> <table> <tr> <th>Column 1 Heading</th> <th>Column 2 Heading</th> </tr> <tr> <td>Data in Column 1, Row 2</td> <td>Data in Column 2, Row 2</td> </tr> <tr> <td>Data in Column 1, Row 3</td> <td>Data in Column 2, Row 3</td> </tr> </table> </body> </html>
In this HTML5 Document example, we have created a table using the <table> tag that has 2 columns and 3 rows. Row 1 of the table is defined using the first <tr> tag. It has 2 table heading cells defined using the <th> tag. Rows 2 and 3 of the table use the <td> tag to define standard table cells.
HTML 4.01 Transitional Document
If you created a new web page in HTML 4.01 Transitional, your <tr> tag might look like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>HTML 4.01 Transitional Example by www.techonthenet.com</title> </head> <body> <table> <tr> <th>Column 1 Heading</th> <th>Column 2 Heading</th> </tr> <tr> <td>Data in Column 1, Row 2</td> <td>Data in Column 2, Row 2</td> </tr> <tr> <td>Data in Column 1, Row 3</td> <td>Data in Column 2, Row 3</td> </tr> </table> </body> </html>
In this HTML 4.01 Transitional Document example, we have created a table using the <table> tag that has 2 columns and 3 rows. Row 1 of the table is defined using the first <tr> tag. It has 2 table heading cells defined using the <th> tag. Rows 2 and 3 of the table use the <td> tag to define standard table cells.
XHTML 1.0 Transitional Document
If you created a new web page in XHTML 1.0 Transitional, your <tr> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>XHMTL 1.0 Transitional Example by www.techonthenet.com</title> </head> <body> <table> <tr> <th>Column 1 Heading</th> <th>Column 2 Heading</th> </tr> <tr> <td>Data in Column 1, Row 2</td> <td>Data in Column 2, Row 2</td> </tr> <tr> <td>Data in Column 1, Row 3</td> <td>Data in Column 2, Row 3</td> </tr> </table> </body> </html>
In this XHTML 1.0 Transitional Document example, we have created a table using the <table> tag that has 2 columns and 3 rows. Row 1 of the table is defined using the first <tr> tag. It has 2 table heading cells defined using the <th> tag. Rows 2 and 3 of the table use the <td> tag to define standard table cells.
XHTML 1.0 Strict Document
If you created a new web page in XHTML 1.0 Strict, your <tr> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>XHTML 1.0 Strict Example by www.techonthenet.com</title> </head> <body> <table> <tr> <th>Column 1 Heading</th> <th>Column 2 Heading</th> </tr> <tr> <td>Data in Column 1, Row 2</td> <td>Data in Column 2, Row 2</td> </tr> <tr> <td>Data in Column 1, Row 3</td> <td>Data in Column 2, Row 3</td> </tr> </table> </body> </html>
In this XHTML 1.0 Strict Document example, we have created a table using the <table> tag that has 2 columns and 3 rows. Row 1 of the table is defined using the first <tr> tag. It has 2 table heading cells defined using the <th> tag. Rows 2 and 3 of the table use the <td> tag to define standard table cells.
XHTML 1.1 Document
If you created a new web page in XHTML 1.1, your <tr> tag might look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>XHTML 1.1 Example by www.techonthenet.com</title> </head> <body> <table> <tr> <th>Column 1 Heading</th> <th>Column 2 Heading</th> </tr> <tr> <td>Data in Column 1, Row 2</td> <td>Data in Column 2, Row 2</td> </tr> <tr> <td>Data in Column 1, Row 3</td> <td>Data in Column 2, Row 3</td> </tr> </table> </body> </html>
In this XHTML 1.1 Document example, we have created a table using the <table> tag that has 2 columns and 3 rows. Row 1 of the table is defined using the first <tr> tag. It has 2 table heading cells defined using the <th> tag. Rows 2 and 3 of the table use the <td> tag to define standard table cells.
What Does Tr Stand for in Html
Source: https://www.techonthenet.com/html/elements/tr_tag.php
0 Response to "What Does Tr Stand for in Html"
Post a Comment