Copyright © tutorialspoint.com

HTML <tr> tag



Advertisements

Function:

The HTML <tr> tag is used for specifying a table row within a table.

Difference between HTML and XHTML:

The bgcolor attribute is deprecated in HTML as well in XHTML.

Example:

<table width="100%" border = "1">
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</table>

This will produce following result:

Cell 1 Cell 2

Online Practice:

To Become more comfortable - Do Online Practice

Attributes:

AttributeValueDescription
alignright
left
center
justify
char
Visual alignment.
bgcolorrgb(x,x,x)
#hexcode
colorname
Deprecated - Specifies the background color of the table cell.
charcharacterSpecifies which character to align text on. Used when align="char"
charoffpixels or %Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute. Used when align="char"
valigntop
middle
bottom
baseline
Vertical alignment.

Standard Attributes:

AttributeDescription
classDocument wide identifier
dirSpecifies the direction of the text
idDocument wide identifier
titleSpecifies a title to associate with the element.
styleHelps to include inline casecadubf style sheet.
langSets the language code.
xml:langSets the language code.

Event Attributes:

AttributeDescription
onclickScript runs when a mouse click
ondblclickScript runs when a mouse double-click
onmousedownScript runs when mouse button is pressed
onmouseupScript runs when mouse button is released
onmouseoverScript runs when mouse pointer moves over an element
onmousemoveScript runs when mouse pointer moves
onmouseoutScript runs when mouse pointer moves out of an element
onkeypressScript runs when key is pressed and released
onkeydownScript runs when key is pressed
onkeyupScript runs when key is released

Copyright © tutorialspoint.com