When a webpage loads, the browser doesn’t directly show the HTML file.Instead, it reads the HTML and creates a live, structured version of the page called the DOM — Document Object Model.
HTML is the plan
DOM is the actual page the browser builds from that plan
The DOM looks like a tree structure, where every HTML tag becomes a part of that tree.
Example:
Css
<body>
<h1>Hello</h1>
<p>Welcome to my website</p>
</body>
Document
└── body
├── h1
└── p
Each item (h1, p, body) becomes a node in the DOM.
Top comments (0)