DEV Community

Himanshupal0001
Himanshupal0001

Posted on

DOM guide for beginners #1

What is DOM?

DOM is a document object model which is created by browser while rendering html. In simple words from line <!Doctype> to </html> in a HTML file is DOM/document. It basically refer to as tree like structure of HTML. Html has a family like structure which includes ancestors, decedents, parents, children, grandchildren, great grandchildren and so on. It is used to manipulate html by js.

What are the things you should know before learning DOM?

TAG ELEMENT ATTRIBUTE NODE

TAG

<h1></h1> --------------> This is tag

ELEMENT

<h1>.....any text....</h1> ------------------> This is element

ATTRIBUTE

  • All HTML elements can have attributes
  • Attributes provide additional information about elements
  • Attributes are always specified in the start tag
  • Attributes usually come in name/value pairs like: name="value"

<a href = "google.com" height:100px width:100px></a> -----------> href, height, width is attribute.

NODE

Everything written in HTML is node.

Image description

Top comments (0)