Tutorials Point


  HTML Home

  HTML Tags Reference
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

HTML <td> tag




Advertisements

Function:

The HTML &ld;td> tag is used for specifying a cell or table data within a table.

Difference between HTML and XHTML:

The bgcolor, height, width, nowrap attributes are 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
abbrabbreviated_textSpecifies an abbreviated version of the content in a cell.
alignright
left
center
justify
char
Visual alignment.
axisnameSpecifies a category for this td. This can potentially be used to perform queries against the table data and can be beneficial in the context of a speech browser.
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"
colspannumberSpecifies the number of columns the current cell spans across.
headeridSpecifies a space-separated list of header cells that contain information about this cell. The value needs to correspond with the id of the header cell (which is set using the id attribute). This attribute is useful for non-visual browsers.
heightpixelsDeprecated - Specifies the height of the table cell
nowrapnowrapDeprecated - Prevents text from automatically wrapping.
rowspannumberSpecifies the number of rows the current cell spans across.
scopecol
colgroup
row
rowgroup
This attribute is used on header cells and specifies the cells that will use this header's information.
valigntop
middle
bottom
baseline
Vertical alignment.
widthpixels or %Specifies the width of the table cell

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

Printer Friendly

Advertisements


  

Advertisements