HTML td tag

Definition of HTML td tag

HTML td tag is used in tables to show data cells.

The tag comes with tr tag as a group or singles to show tabular data in rows. Combination of multiple data cells in a row, makes a single data line of the table.



Syntax:

Output

Sr. No Company Name
1 Apple
2 Asus
3 HP

Element Specific Attributes

Sr. No. Attribute Name Description
1 abbr define the abbreviated content in the table cell.

  • This holds a value of abbreviated text
2 align align the table cells content to a defined location.

  • The possible value for this can be from one of these :
    • left
    • right
    • center
    • justify
    • char
3 axis The axis attribute used to define the category of the table cell.

  • the value for this can be a category name.
4 bgcolor Define a background color for the cell with the attribute.

  • the value to specify for this :
    • A color name
    • hexcode(eg #ccc)
    • rgb formate color code, e.g. (rgb(x, x, x))
5 char This attribute is used only when you specify the value of the align attribute as char (align=”char”). You specify this attribute when you want to specify the character in table cells to align, .

  • Any character is the value for this.
6 charoff Use this attribute only after you specify align=”char”. This defines an alignment offset against the first character with this attribute.

  • the possible value for this:
    • pixel (eg. 20px)
    • A percentage (eg. 8%)
7 colspan A colspan attribute is used in cells to specify the number of columns to merge.

  • the value for this can be a number
8 height Define the height of the cell with this attribute.

  • this holds a pixel value.
9 nowrap Define this attribute to prevent the automatic wrapping of the cells.

  • the possible value for this is nowrap.
10 rowspan We use this attribute to merge the rows of cells.

  • this holds a numeric value.
11 valign Vertically align the text in the specified location.

  • the value for this can be:
    • top
    • bottom
    • middle
    • baseline
12 width This Defines the width of the cell.

  • the value for this can be given in pixels or percentage (%).

Resources and References for HTML td tag

See W3C Specification for this tag.

Leave a Reply

Your email address will not be published. Required fields are marked *