Table of Contents

Class HTMLTableElement

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The HTMLTableElement interface provides special properties and methods (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating the layout and presentation of tables in an HTML document.

[Value("HTMLTableElement")]
public class HTMLTableElement : HTMLElement
Inheritance
HTMLTableElement
Inherited Members

Remarks

-The HTML element implementing this interface: table.

See also on MDN

Constructors

HTMLTableElement()

public HTMLTableElement()

Properties

Align

IMPORTANT
Deprecated
The HTMLTableElement.align property represents the
alignment of the table.
[Value("align")]
public string Align { get; set; }

Property Value

string

One of the following string values:

Remarks

BgColor

IMPORTANT
Deprecated
The bgcolor property of the HTMLTableElement represents the
background color of the table.
[Value("bgColor")]
public string BgColor { get; set; }

Property Value

string

A string representing a color value.When set to the null value, that null value is converted to the empty string (""), so elt.bgColor = null is equivalent to elt.bgColor = "".

Remarks

NOTE

Do not use this attribute anymore. Instead, use the CSS background-color property by modifying the element's style attribute or using a style rule.

-background-color

See also on MDN

Border

IMPORTANT
Deprecated
The HTMLTableElement.border property represents the
border width of the table element.
[Value("border")]
public string Border { get; set; }

Property Value

string

A string representing the width of the border in pixels.

Remarks

Caption

The HTMLTableElement.caption property represents the
table caption. If no caption element is associated with the table, this property is
null.

[Value("caption")]
public HTMLTableCaptionElement? Caption { get; set; }

Property Value

HTMLTableCaptionElement

A string.

Remarks

-The interface implementing this property: HTMLTableElement.

See also on MDN

CellPadding

IMPORTANT
Deprecated
The HTMLTableElement.cellPadding property represents the
padding around the individual cells of the table.
[Value("cellPadding")]
public string CellPadding { get; set; }

Property Value

string

A string representing pixels (e.g., "10") or a percentage value (e.g., "10%").When set to the null value, that null value is converted to the empty string (""), so elt.cellPadding = null is equivalent to elt.cellPadding = "".

Remarks

CellSpacing

IMPORTANT
Deprecated
While you should instead use the CSS
{{cssxref("border-spacing")}} property, the obsolete HTMLTableElement
interface's cellSpacing property represents the spacing
around the individual th and td elements
representing a table's cells. Any two cells are separated by the sum of the
cellSpacing of each of the two cells.
[Value("cellSpacing")]
public string CellSpacing { get; set; }

Property Value

string

A string which is either a number of pixels (such as "10") or a percentage value (like "10%").When set to the null value, that null value is converted to the empty string (""), so elt.cellSpacing = null is equivalent to elt.cellSpacing = "".

Remarks

Frame

IMPORTANT
Deprecated
The HTMLTableElement interface's frame
property is a string that indicates which of the table's exterior borders should be
drawn.
[Value("frame")]
public string Frame { get; set; }

Property Value

string

One of the following:

Remarks

Rows

The read-only HTMLTableElement
property rows returns a live
HTMLCollection of all the rows in the table, including the rows
contained within any thead, tfoot, and
tbody elements.

[Value("rows")]
public HTMLCollection Rows { get; }

Property Value

HTMLCollection

An HTMLCollection providing a live-updating list of the
HTMLTableRowElement objects representing all of the {{HTMLElement("tr")}}
elements contained in the table. This provides quick access to all of the table rows,
without having to manually search for them.

Remarks

Although the property itself is read-only, the returned object is live and allows the
modification of its content.

See also on MDN

Rules

IMPORTANT
Deprecated
The HTMLTableElement.rules property indicates which cell
borders to render in the table.
[Value("rules")]
public string Rules { get; set; }

Property Value

string

One of the following:

Remarks

Summary

IMPORTANT
Deprecated
The HTMLTableElement.summary property represents the
table description.
[Value("summary")]
public string Summary { get; set; }

Property Value

string

A string.

Remarks

TBodies

The HTMLTableElement.tBodies read-only property returns a
live HTMLCollection of the bodies in a {{htmlElement("table")}}.

[Value("tBodies")]
public HTMLCollection TBodies { get; }

Property Value

HTMLCollection

A live HTMLCollection.

Remarks

Although the property is read-only, the returned object is live and allows the
modification of its content.

The collection returned includes implicit tbody elements. For
example:

The HTML DOM generated from the above HTML will have a tbody element
even though the tags are not included in the source HTML.

-HTMLCollection
-tbody

See also on MDN

TFoot

The HTMLTableElement.tFoot property represents the
tfoot element of a table. Its value will be
null if there is no such element.

[Value("tFoot")]
public HTMLTableSectionElement? TFoot { get; set; }

Property Value

HTMLTableSectionElement

A tfoot element or null.

Remarks

-The interface implementing this property: HTMLTableElement.

See also on MDN

THead

The HTMLTableElement.tHead represents the
thead element of a table. Its value will be
null if there is no such element.

[Value("tHead")]
public HTMLTableSectionElement? THead { get; set; }

Property Value

HTMLTableSectionElement

A HTMLTableSectionElement.

Remarks

-The interface implementing this property: HTMLTableElement.

See also on MDN

Width

IMPORTANT
Deprecated
The HTMLTableElement.width property represents the
desired width of the table.
[Value("width")]
public string Width { get; set; }

Property Value

string

A string representing the width in number of pixels or as a percentage value.

Remarks

Methods

CreateCaption()

The HTMLTableElement.createCaption() method returns the
caption element associated with a given table.
If no <caption> element exists on the table, this method creates
it, and then returns it.

[Value("createCaption")]
public HTMLTableCaptionElement CreateCaption()

Returns

HTMLTableCaptionElement

HTMLTableCaptionElement

Remarks

NOTE

If no caption exists, createCaption() inserts a
new caption directly into the table. The caption does not need to be added
separately as would be the case if CreateElement(string, Union34) had
been used to create the new <caption> element.

See also on MDN

CreateTBody()

The createTBody() method of
HTMLTableElement objects creates and returns a new
tbody element associated with a given table.

[Value("createTBody")]
public HTMLTableSectionElement CreateTBody()

Returns

HTMLTableSectionElement

HTMLTableSectionElement

Remarks

NOTE

Unlike CreateTHead() and
CreateTFoot(), createTBody()
systematically creates a new <tbody> element, even if the table
already contains one or more bodies. If so, the new one is inserted after the existing
ones.

See also on MDN

CreateTFoot()

The createTFoot() method of
HTMLTableElement objects returns the {{HTMLElement("tfoot")}} element
associated with a given table. If no footer exists in the table, this
method creates it, and then returns it.

[Value("createTFoot")]
public HTMLTableSectionElement CreateTFoot()

Returns

HTMLTableSectionElement

HTMLTableSectionElement

Remarks

NOTE

If no footer exists, createTFoot() inserts a new
footer directly into the table. The footer does not need to be added separately as
would be the case if CreateElement(string, Union34) had been used to create
the new <tfoot> element.

See also on MDN

CreateTHead()

The createTHead() method of
HTMLTableElement objects returns the {{HTMLElement("thead")}} element
associated with a given table. If no header exists in the table, this
method creates it, and then returns it.

[Value("createTHead")]
public HTMLTableSectionElement CreateTHead()

Returns

HTMLTableSectionElement

HTMLTableSectionElement

Remarks

NOTE

If no header exists, createTHead() inserts a new
header directly into the table. The header does not need to be added separately as
would be the case if CreateElement(string, Union34) had been used to create
the new <thead> element.

See also on MDN

DeleteCaption()

The HTMLTableElement.deleteCaption() method removes the
caption element from a given table. If there is no
<caption> element associated with the table, this method does
nothing.

[Value("deleteCaption")]
public GlobalObject.Undefined DeleteCaption()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

DeleteRow(long)

The HTMLTableElement.deleteRow() method removes a
specific row (tr) from a given table.

[Value("deleteRow")]
public GlobalObject.Undefined DeleteRow(long index)

Parameters

index long

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

DeleteTFoot()

The HTMLTableElement.deleteTFoot() method removes the
tfoot element from a given table.

[Value("deleteTFoot")]
public GlobalObject.Undefined DeleteTFoot()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

DeleteTHead()

The HTMLTableElement.deleteTHead() removes the
thead element from a given table.

[Value("deleteTHead")]
public GlobalObject.Undefined DeleteTHead()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

InsertRow(long)

The insertRow() method of the HTMLTableElement interface inserts a new row
(tr) in a given table, and returns a reference to
the new row.

[Value("insertRow")]
public HTMLTableRowElement InsertRow(long index = 0)

Parameters

index long

Returns

HTMLTableRowElement

An HTMLTableRowElement that references the new
row.

Remarks

If a table has multiple tbody elements, by default, the new row is
inserted into the last <tbody>.
To insert the row into a specific section, use InsertRow(long)

NOTE

insertRow() inserts the row directly into the
table. The row does not need to be appended separately as would be the case if
CreateElement(string, Union34) had been used to create the new
<tr> element.

-InsertCell(long)
-InsertRow(long)

See also on MDN