A browser reads HTML and creates the DOM(Document Object Model) of the document with its structure and content. DOM is platform and language neutral API. W3C is responsible for the DOM specifications.
DOM specifications are divided into multiple levels.
DOM levels:
Browsers have a software called Browser Engine which is responsible for creting DOM. Most browsers implement DOM using Javascripts (Chrome, Mozilla) Once the browser read HTML code it creates a JavaScript object Node. Node has some classes such as Attr, CharacterData, ProcessingInstruction and DocumentType. After creating Nodes the browser creates a tree-like structure of these same Nodes objects. After creating DOM the browser then reads CSS and construct CSSOM which same tree structure but for css objects. Finally, the browser creates the Rende-Tree which is a combination of DOM Tree and CSS Tree. A software called Browser ENgine
It was very interesting to find out more details about DOM. I found many intriguing facts I didnt know before like that browsers implement DOM using Javascript however, Javascript doesnt understand what DOM is as its not a part of JS specifications. Another interesting fact is that browsers implement DOM by creating JavaScript Nodes. Thus, Javascript seems to be a very powerful language no wonder it is harder to learn comparing to HTML and CSS.