How does a browser render a webpage?
There are 6 general steps in this process:
Construct DOM tree: a tree of nodes corresponding toHTMLelementsConstruct CSSOM tree: a tree of nodes corresponding toCSSselectorsConstruct Render tree: The browser traverses the DOM tree and matches every element with the appropriate style from theCSSOMtree.Layout phase. geometry phase where browsers calculate the position of every elementPainting phase. The browser uses a render tree to paint or display pixels currently within your viewportRepainting phase: if we change the DOM tree, the browser must repaint the affected regions