Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

JS Reference

JS by Category JS by Alphabet

JavaScript

JS Arrays JS Boolean JS Classes JS Dates JS Error JS Global JS JSON JS Maps JS Math JS Numbers JS Objects JS Operators JS Precedence JS Promises JS RegExp JS Sets JS Statements JS Strings JS TypedArray

Window

Window Object Window Console Window History Window Location Window Navigator Window Screen

HTML DOM

HTML Documents HTML Elements HTML Attributes HTML Collection HTML NodeList HTML DOMTokenList HTML Styles
alignContent alignItems alignSelf animation animationDelay animationDirection animationDuration animationFillMode animationIterationCount animationName animationTimingFunction animationPlayState background backgroundAttachment backgroundClip backgroundColor backgroundImage backgroundOrigin backgroundPosition backgroundRepeat backgroundSize backfaceVisibility border borderBottom borderBottomColor borderBottomLeftRadius borderBottomRightRadius borderBottomStyle borderBottomWidth borderCollapse borderColor borderImage borderImageOutset borderImageRepeat borderImageSlice borderImageSource borderImageWidth borderLeft borderLeftColor borderLeftStyle borderLeftWidth borderRadius borderRight borderRightColor borderRightStyle borderRightWidth borderSpacing borderStyle borderTop borderTopColor borderTopLeftRadius borderTopRightRadius borderTopStyle borderTopWidth borderWidth bottom boxShadow boxSizing captionSide caretColor clear clip color columnCount columnFill columnGap columnRule columnRuleColor columnRuleStyle columnRuleWidth columns columnSpan columnWidth counterIncrement counterReset cssFloat cursor direction display emptyCells filter flex flexBasis flexDirection flexFlow flexGrow flexShrink flexWrap font fontFamily fontSize fontStyle fontVariant fontWeight fontSizeAdjust height isolation justifyContent left letterSpacing lineHeight listStyle listStyleImage listStylePosition listStyleType margin marginBottom marginLeft marginRight marginTop maxHeight maxWidth minHeight minWidth objectFit objectPosition opacity order orphans outline outlineColor outlineOffset outlineStyle outlineWidth overflow overflowX overflowY padding paddingBottom paddingLeft paddingRight paddingTop pageBreakAfter pageBreakBefore pageBreakInside perspective perspectiveOrigin position quotes resize right scrollBehavior tableLayout tabSize textAlign textAlignLast textDecoration textDecorationColor textDecorationLine textDecorationStyle textIndent textOverflow textShadow textTransform top transform transformOrigin transformStyle transition transitionProperty transitionDuration transitionTimingFunction transitionDelay unicodeBidi userSelect verticalAlign visibility width wordBreak wordSpacing wordWrap widows zIndex

HTML Events

HTML Events HTML Event Objects HTML Event Properties HTML Event Methods

Web APIs

API Canvas API Console API Fetch API Fullscreen API Geolocation API History API MediaQueryList API Storage API Validation API Web

HTML Objects

<a> <abbr> <address> <area> <article> <aside> <audio> <b> <base> <bdo> <blockquote> <body> <br> <button> <canvas> <caption> <cite> <code> <col> <colgroup> <datalist> <dd> <del> <details> <dfn> <dialog> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <footer> <form> <head> <header> <h1> - <h6> <hr> <html> <i> <iframe> <img> <ins> <input> button <input> checkbox <input> color <input> date <input> datetime <input> datetime-local <input> email <input> file <input> hidden <input> image <input> month <input> number <input> password <input> radio <input> range <input> reset <input> search <input> submit <input> text <input> time <input> url <input> week <kbd> <label> <legend> <li> <link> <map> <mark> <menu> <menuitem> <meta> <meter> <nav> <object> <ol> <optgroup> <option> <output> <p> <param> <pre> <progress> <q> <s> <samp> <script> <section> <select> <small> <source> <span> <strong> <style> <sub> <summary> <sup> <table> <tbody> <td> <tfoot> <th> <thead> <tr> <textarea> <time> <title> <track> <u> <ul> <var> <video>

Other References

CSSStyleDeclaration JS Conversion


HTML DOM Elements


The Element Object

In the HTML DOM, the Element object represents an HTML element, like P, DIV, A, TABLE, or any other HTML element.


Properties and Methods

The following properties and methods can be used on all HTML elements:

Property / Method Description
accessKey Sets or returns the accesskey attribute of an element
addEventListener() Attaches an event handler to an element
appendChild() Adds (appends) a new child node to an element
attributes Returns a NamedNodeMap of an element's attributes
blur() Removes focus from an element
childElementCount Returns an elements's number of child elements
childNodes Returns a NodeList of an element's child nodes
children Returns an HTMLCollection of an element's child elements
classList Returns the class name(s) of an element
className Sets or returns the value of the class attribute of an element
click() Simulates a mouse-click on an element
clientHeight Returns the height of an element, including padding
clientLeft Returns the width of the left border of an element
clientTop Returns the width of the top border of an element
clientWidth Returns the width of an element, including padding
cloneNode() Clones an element
closest() Searches the DOM tree for the closest element that matches a CSS selector
compareDocumentPosition() Compares the document position of two elements
contains() Returns true if a node is a descendant of a node
contentEditable Sets or returns whether the content of an element is editable or not
dir Sets or returns the value of the dir attribute of an element
firstChild Returns the first child node of an element
firstElementChild Returns the first child element of an element
focus() Gives focus to an element
getAttribute() Returns the value of an element's attribute
getAttributeNode() Returns an attribute node
getBoundingClientRect() Returns the size of an element and its position relative to the viewport
getElementsByClassName() Returns a collection of child elements with a given class name
getElementsByTagName() Returns a collection of child elements with a given tag name
hasAttribute() Returns true if an element has a given attribute
hasAttributes() Returns true if an element has any attributes
hasChildNodes() Returns true if an element has any child nodes
id Sets or returns the value of the id attribute of an element
innerHTML Sets or returns the content of an element
innerText Sets or returns the text content of a node and its descendants
insertAdjacentElement() Inserts a new HTML element at a position relative to an element
insertAdjacentHTML() Inserts an HTML formatted text at a position relative to an element
insertAdjacentText() Inserts text into a position relative to an element
insertBefore() Inserts a new child node before an existing child node
isContentEditable Returns true if an element's content is editable
isDefaultNamespace() Returns true if a given namespaceURI is the default
isEqualNode() Checks if two elements are equal
isSameNode() Checks if two elements are the same node
isSupported() Deprecated
lang Sets or returns the value of the lang attribute of an element
lastChild Returns the last child node of an element
lastElementChild Returns the last child element of an element
matches() Returns true if an element is matched by a given CSS selector
namespaceURI Returns the namespace URI of an element
nextSibling Returns the next node at the same node tree level
nextElementSibling Returns the next element at the same node tree level
nodeName Returns the name of a node
nodeType Returns the node type of a node
nodeValue Sets or returns the value of a node
normalize() Joins adjacent text nodes and removes empty text nodes in an element
offsetHeight Returns the height of an element, including padding, border and scrollbar
offsetWidth Returns the width of an element, including padding, border and scrollbar
offsetLeft Returns the horizontal offset position of an element
offsetParent Returns the offset container of an element
offsetTop Returns the vertical offset position of an element
outerHTML Sets or returns the content of an element (including the start tag and the end tag)
outerText Sets or returns the outer text content of a node and its descendants
ownerDocument Returns the root element (document object) for an element
parentNode Returns the parent node of an element
parentElement Returns the parent element node of an element
previousSibling Returns the previous node at the same node tree level
previousElementSibling Returns the previous element at the same node tree level
querySelector() Returns the first child element that matches a CSS selector(s)
querySelectorAll() Returns all child elements that matches a CSS selector(s)
remove() Removes an element from the DOM
removeAttribute() Removes an attribute from an element
removeAttributeNode() Removes an attribute node, and returns the removed node
removeChild() Removes a child node from an element
removeEventListener() Removes an event handler that has been attached with the addEventListener() method
replaceChild() Replaces a child node in an element
scrollHeight Returns the entire height of an element, including padding
scrollIntoView() Scrolls the an element into the visible area of the browser window
scrollLeft Sets or returns the number of pixels an element's content is scrolled horizontally
scrollTop Sets or returns the number of pixels an element's content is scrolled vertically
scrollWidth Returns the entire width of an element, including padding
setAttribute() Sets or changes an attribute's value
setAttributeNode() Sets or changes an attribute node
style Sets or returns the value of the style attribute of an element
tabIndex Sets or returns the value of the tabindex attribute of an element
tagName Returns the tag name of an element
textContent Sets or returns the textual content of a node and its descendants
title Sets or returns the value of the title attribute of an element
toString() Converts an element to a string

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.