Element

Baseline
Widely available
*

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

Element is the most general base class from which all element objects (i.e., objects that represent elements) in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element.

For example, the HTMLElement interface is the base interface for HTML elements. Similarly, the SVGElement interface is the basis for all SVG elements, and the MathMLElement interface is the base interface for MathML elements. Most functionality is specified further down the class hierarchy.

Languages outside the realm of the Web platform, like XUL through the XULElement interface, also implement Element.

EventTarget Node Element

Instance properties

Element inherits properties from its parent interface, Node, and by extension that interface's parent, EventTarget.

Element.activeViewTransition Read only

Returns a ViewTransition instance representing the view transition currently active on an element.

Element.assignedSlot Read only

Returns a HTMLSlotElement representing the <slot> the node is inserted in.

Element.attributes Read only

Returns a NamedNodeMap object containing the assigned attributes of the corresponding HTML element.

Element.childElementCount Read only

Returns the number of child elements of this element.

Element.children Read only

Returns the child elements of this element.

Element.classList Read only

Returns a DOMTokenList containing the list of class attributes.

Element.className

A string representing the class of the element.

Element.clientHeight Read only

Returns a number representing the inner height of the element.

Element.clientLeft Read only

Returns a number representing the width of the left border of the element.

Element.clientTop Read only

Returns a number representing the width of the top border of the element.

Element.clientWidth Read only

Returns a number representing the inner width of the element.

Element.currentCSSZoom Read only

A number indicating the effective zoom size of the element, or 1.0 if the element is not rendered.

Element.customElementRegistry Read only

The CustomElementRegistry object associated with this element, or null if one has not been set.

Element.elementTiming

A string reflecting the elementtiming attribute which marks an element for observation in the PerformanceElementTiming API.

Element.firstElementChild Read only

Returns the first child element of this element.

Element.id

A string representing the id of the element.

Element.innerHTML

A string representing the markup of the element's content.

Element.lastElementChild Read only

Returns the last child element of this element.

Element.localName Read only

A string representing the local part of the qualified name of the element.

Element.namespaceURI Read only

The namespace URI of the element, or