How HTML Works
A browser is a complex piece of software. It does not simply "show" text; it parses, constructs, and paints it. This journey from code to pixels is critical for performance.
The Parser
When the server sends data, it arrives as raw bytes. The browser converts these into characters, then into Tokens. A token is an atomic unit of meaning, like a start tag or an end tag.
The DOM Tree
Tokens are converted into Objects (Nodes). These nodes are linked in a tree structure called the DOM (Document Object Model). The hierarchy is strict: if a <p> is inside a <div>, the P node is a child of the Div node.
Rendering
Once the DOM and CSSOM (CSS Object Model) are built, they combine to form the Render Tree. The browser then calculates geometry (Layout) and finally paints pixels to the screen.
View Full Technical Transcript+
This section contains deep technical details on the Tokenizer state machine, tree construction algorithm, and how the browser handles invalid syntax through auto-correction mechanisms defined in the HTML5 specification.
