The structure of the DOM is tree-shaped because, typically, it took form with a single parent-object (a stem) that branches out into several child elements (branches), each of which may have leaves. In the case of HTML documents, the stem is the root <html> element, the branches” are the nested elements, and the “leaves” are the content.
DOM is a way to convert the structure and content of the static HTML document into an object model that can be used by various programs.
In internet browsers, it works as following:
Also, today's browsers use a DOM API that enables interaction with the DOM elements, making the websites dynamic.