HTML td tag

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. NoCompany Name
1Apple
2Asus
3HP

Element Specific Attributes

Sr. No.Attribute NameDescription
1abbrdefine the abbreviated content in the table cell.

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

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

  • the value for this can be a category name.
4bgcolorDefine 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))
5charThis 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.
6charoffUse 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%)
7colspanA colspan attribute is used in cells to specify the number of columns to merge.

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

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

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

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

  • the value for this can be:
    • top
    • bottom
    • middle
    • baseline
12widthThis 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 comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.