Content · Web Development · HTML

HTML How Browsers Build the DOM from HTML Source

Browsers parse the HTML text and build a Document Object Model, or DOM, made of nodes. This tree is what JavaScript and Developer Tools usually work with.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

Browsers parse the HTML text and build a Document Object Model, or DOM, made of nodes. This tree is what JavaScript and Developer Tools usually work with.

What You Need to Know


The browser can insert missing wrapper elements when parsing, such as tbody inside a table. The DOM may therefore contain elements you did not type literally.

Example: See It in Action


Add this example to the appropriate part of a practice HTML page. Read each line before you open the page in your browser.

This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.

<table>
    <tr>
        <td>First</td>
    </tr>
    <tr>
        <td>Second</td>
    </tr>
</table>
<!-- The browser adds a tbody element to the DOM. -->

Let’s Understand the Example


  • Table represents information whose row and column relationships matter.
  • Tr creates one row of table cells.
  • Td is an ordinary data cell in a table.

Look at a data cell and ask: “What row and column does this value belong to?” The header elements help answer that question, including for people who navigate the table with a screen reader.

What Should You See?


The page should include “First”. If it looks different from what you expected, open developer tools and compare the source with the elements the browser created.

Try removing one piece of markup in a scratch copy, refresh the page, and compare the behavior. This is often the fastest way to understand what that piece contributes.

Try It Yourself


  1. Inspect the example table and look for a tbody node that is absent from the source snippet.
  2. Save your changes, open or refresh the page, and compare the result with the original example.
  3. Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.

Common Beginner Mistakes


  • Assuming the source text and live DOM must always have exactly the same elements.
  • Avoid picking tags just for their default bold, italic or spaced appearance. Use CSS for presentation.

Key Takeaways


  • Browsers parse the HTML text and build a Document Object Model, or DOM, made of nodes.
  • Table represents information whose row and column relationships matter.
  • The browser can insert missing wrapper elements when parsing, such as tbody inside a table. The DOM may therefore contain elements you did not type literally.
Share this resourceSend this page to someone who may find it useful.