Html table cell element

: The Table Data Cell element

The HTML element defines a cell of a table that contains data. It participates in the table model.

Try it

Attributes

This element includes the global attributes.

This attribute contains a non-negative integer value that indicates for how many columns the cell extends. Its default value is 1 . Values higher than 1000 will be considered as incorrect and will be set to the default value (1).

This attribute contains a list of space-separated strings, each corresponding to the id attribute of the elements that apply to this element.

This attribute contains a non-negative integer value that indicates for how many rows the cell extends. Its default value is 1 ; if its value is set to 0 , it extends until the end of the table section ( , , , even if implicitly defined), that the cell belongs to. Values higher than 65534 are clipped down to 65534.

Deprecated attributes

This attribute contains a short abbreviated description of the cell’s content. Some user-agents, such as speech readers, may present this description before the content itself.

Note: Do not use this attribute as it is obsolete in the latest standard. Alternatively, you can put the abbreviated description inside the cell and place the long content in the title attribute.

Читайте также:  Создать свою hashtable java

This enumerated attribute specifies how the cell content’s horizontal alignment will be handled. Possible values are:

  • left : The content is aligned to the left of the cell.
  • center : The content is centered in the cell.
  • right : The content is aligned to the right of the cell.
  • justify (with text only): The content is stretched out inside the cell so that it covers its entire width.
  • char (with text only): The content is aligned to a character inside the element with minimal offset. This character is defined by the char and charoff attributes.

The default value when this attribute is not specified is left .

  • To achieve the same effect as the left , center , right or justify values, apply the CSS text-align property to the element.
  • To achieve the same effect as the char value, give the text-align property the same value you would use for the char .

This attribute contains a list of space-separated strings. Each string is the id of a group of cells that this header applies to.

This attribute defines the background color of each cell in a column. It is a 6-digit hexadecimal RGB code, prefixed by a ‘ # ‘. One of the predefined color keywords can also be used.

To achieve a similar effect, use the CSS background-color property.

The content in the cell element is aligned to a character. Typical values include a period (.) to align numbers or monetary values. If align is not set to char , this attribute is ignored.

This attribute is used to shift column data to the right of the character specified by the char attribute. Its value specifies the length of this shift.

This attribute is used to define a recommended cell height. Use the CSS height property instead.

This attribute specifies how a text is vertically aligned inside a cell. Possible values for this attribute are:

  • baseline : Positions the text near the bottom of the cell and aligns it with the baseline of the characters instead of the bottom. If characters don’t descend below the baseline, the baseline value achieves the same effect as bottom .
  • bottom : Positions the text near the bottom of the cell.
  • middle : Centers the text in the cell.
  • and top : Positions the text near the top of the cell.

To achieve a similar effect, use the CSS vertical-align property.

This attribute is used to define a recommended cell width. Use the CSS width property instead.

Examples

Technical summary

Content categories Sectioning root.
Permitted content Flow content.
Tag omission The start tag is mandatory.
The end tag may be omitted, if it is immediately followed by a or element or if there are no more data in its parent element.
Permitted parents A element.
Implicit ARIA role cell if a descendant of a element
Permitted ARIA roles Any
DOM interface HTMLTableCellElement

Specifications

Browser compatibility

BCD tables only load in the browser

Found a content problem with this page?

This page was last modified on Apr 13, 2023 by MDN contributors.

Your blueprint for a better internet.

MDN

Support

Our communities

Developers

Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998– 2023 by individual mozilla.org contributors. Content available under a Creative Commons license.

Источник

HTMLTableCellElement

The HTMLTableCellElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of table cells, either header cells ( )) or data cells ( ), in an HTML document.

Instance properties

Instance methods

Deprecated properties

Warning: These properties have been deprecated and should no longer be used. They are documented primarily to help understand older code bases.

HTMLTableCellElement.align Deprecated A string containing an enumerated value reflecting the align attribute. It indicates the alignment of the element’s contents with respect to the surrounding context. The possible values are «left» , «right» , and «center» . HTMLTableCellElement.axis Deprecated A string containing a name grouping cells in virtual. It reflects the obsolete axis attribute. HTMLTableCellElement.bgColor Deprecated A string containing the background color of the cells. It reflects the obsolete bgColor attribute. HTMLTableCellElement.ch Deprecated A string containing one single character. This character is the one to align all the cell of a column on. It reflects the char and default to the decimal points associated with the language, e.g. ‘.’ for English, or ‘,’ for French. This property was optional and was not very well supported. HTMLTableCellElement.chOff Deprecated A string containing an integer indicating how many characters must be left at the right (for left-to-right scripts; or at the left for right-to-left scripts) of the character defined by HTMLTableCellElement.ch . This property was optional and was not very well supported. HTMLTableCellElement.height Deprecated A string containing a length of pixel of the hinted height of the cell. It reflects the obsolete height attribute. HTMLTableCellElement.noWrap Deprecated A boolean value reflecting the nowrap attribute and indicating if cell content can be broken in several lines. HTMLTableCellElement.vAlign Deprecated A string representing an enumerated value indicating how the content of the cell must be vertically aligned. It reflects the valign attribute and can have one of the following values: «top» , «middle» , «bottom» , or «baseline» . Use the CSS vertical-align property instead. HTMLTableCellElement.width Deprecated A string specifying the number of pixels wide the cell should be drawn, if possible. This property reflects the also obsolete width attribute. Use the CSS width property instead.

Specifications

Browser compatibility

See also

Found a content problem with this page?

Источник

HTMLTableCellElement

The HTMLTableCellElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of table cells, either header or data cells, in an HTML document.

Properties

Inherits properties from its parent, HTMLElement .

An unsigned long integer indicating the number of columns this cell must span; this lets the cell occupy space across multiple columns of the table. It reflects the colspan attribute.

An unsigned long integer indicating the number of rows this cell must span; this lets a cell occupy space across multiple rows of the table. It reflects the rowspan attribute.

The header cell applies to the following cells in the same column (or columns, if colspan is used as well), until either the end of the column or another in the column establishes a new scope.

The header cell applies to all cells in the current column group that do not already have a scope applied to them. This value is only allowed if the cell is in a column group.

The header cell applies to the following cells in the same row (or rows, if rowspan is used as well), until either the end of the row or another in the same row establishes a new scope.

The header cell applies to all cells in the current row group that do not already have a scope applied to them. This value is only allowed if the cell is in a row group.

The header cell has no predefined scope; the user agent will establish the scope based on contextual clues.

Methods

No specific method; inherits methods from its parent, HTMLElement .

Deprecated properties

Warning: These properties have been deprecated and should no longer be used. They are documented primarily to help understand older code bases.

A string containing an enumerated value reflecting the align attribute. It indicates the alignment of the element’s contents with respect to the surrounding context. The possible values are «left» , «right» , and «center» .

A string containing a name grouping cells in virtual. It reflects the obsolete axis attribute.

A string containing the background color of the cells. It reflects the obsolete bgcolor attribute.

A string containing one single character. This character is the one to align all the cell of a column on. It reflects the char and default to the decimal points associated with the language, e.g. ‘.’ for English, or ‘,’ for French. This property was optional and was not very well supported.

A string containing a integer indicating how many characters must be left at the right (for left-to-right scripts; or at the left for right-to-left scripts) of the character defined by HTMLTableCellElement.ch . This property was optional and was not very well supported.

A string containing a length of pixel of the hinted height of the cell. It reflects the obsolete height attribute.

A boolean value reflecting the nowrap attribute and indicating if cell content can be broken in several lines.

A string representing an enumerated value indicating how the content of the cell must be vertically aligned. It reflects the valign attribute and can have one of the following values: «top» , «middle» , «bottom» , or «baseline» . Use the CSS vertical-align property instead.

A string specifying the number of pixels wide the cell should be drawn, if possible. This property reflects the also obsolete width attribute. Use the CSS width property instead.

Specifications

Источник

Оцените статью