As web developers, when we consider various web browsers, we encounter different rendering engines. A rendering engine is the core component that transforms HTML and other assets into what we see on our screens as web pages.
While we may observe over a dozen web browsers in existence, it’s important to note that there are only a handful of rendering engines actively in use today. The most notable ones are:
- Blink — used by Google Chrome, Microsoft Edge, Opera, Electron-based desktop apps such as Slack, VS Code, etc. It was forked by WebKit
- Gecko (-moz-) – used by Mozilla Firefox
- WebKit (-webkit-) — used by Apple Safari
This wiki page compares different rendering engines.
As web developers, knowing the difference between the web browser as a whole and its underlying rendering engine makes it easier for us to understand quirks that vary from one browser to another.
Steps of browser rendering:
Here are some common steps that the browser goes through to render web pages and convert the HTML, CSS, and JavaScript into a visually interactive experience for users.
- Parsing HTML – The HTML code is parsed and the Document Object Model (DOM) is constructed which represents the structure of the content.
- Parsing CSS – The CSS file is loaded and parsed to create the CSS Object Model (CSSOM) to define the styling of the page.
- Render Tree – By combining the DOM and CSSOM, the Render Tree is created including how elements should be displayed and their position with styles.
- Layout Flow – The browser calculates the layout of the page and determines the size and position of the elements of the page based on Render tree.
- Painting – The final and most crucial step of the browser engine is converting the visual representation of the Render Tree into actual pixels on the screen. This includes traversing the Render Tree and applying the calculated values pixel-by-pixel on to the screen.