

Overview of how does CSS works behind the scenes?
source link: https://www.tuicool.com/articles/hit/MrAju2b
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Overview of how does CSS works behind the scenes?


Let’s start by understanding what actually happens to our CSS code when we load up a web page in a browser.
When a browser starts to load the initial HTML file, it takes the loaded HTML code and parses it, which means that it will decode the code line by line.
By this process, the browser builds the so-called DOM (Document Object Modal) which describes the entire web document in a tree with parent, children and sibling elements.

As the browser parses the HTML, it also finds the stylesheets included in the HTML head and just like HTML, CSS is also parsed.
But the parsing of CSS bit more complex.


There are two main steps that are performed during the CSS parsing phase :
1. Conflicting CSS declarations are resolved (also known a cascading)
2. Process final CSS values (for eg- converting a margin defined in percentage units to pixels)
Parsed CSS is also stored in a tree-like structure called CSS Object Modal, similar to DOM.


Both parsed HTML and CSS together form the so-called Render Tree.
With this, we finally have everything we need to render the page.
Visual Formatting Model is something that is used by the browser to actually render the page. It is the algorithm that calculates the boxes(box-model) and determines the layout of these boxes, for each element in the render tree, in order to determine the final layout of the page.
So finally, after the visual formatting model, the website is finally rendered or painted, to the screen.


This is the brief picture of the process that happens behind the scene.
In the next article, we will dive deep into the topic(CSS parsing, visual formatting modal) to know what exactly happens behind the scene.
Follow me on Twitter , LinkedIn or GitHub .
I hope this article is useful to you. Thanks for reading & Keep Learning !!
Recommend
-
82
Pixel users get an exclusive preview of a new behind-the-scenes VR experience of Wes Anderson’s upcoming film “Isle of Dogs.”
-
40
Behind the scenes with the Dragon Ball Legends GCP backend...
-
22
The recently released Excelsior JET 15.3 has introduced out-of-the-box support for Spring Boot applications. Turning your Spring Boot jar into an optimized native binary has become as easy as adding a few lines to yourpo...
-
44
If you have code on GitHub, chances are that you’ve had a security vulnerability alert at some point. Since the feature launched, GitHub has sent more than 62 million security alerts for vulnerable dependencies.
-
45
无法访问此网站 medium.com 拒绝了我们的连接请求。 ...
-
9
BH USA 2019 Behind the scenesSkip to content Another good run at BlackHat came to an end. I always wanted to write about what goes behind the scenes. Thi...
-
10
Behind the Scenes with Infinite RedWhat it’s like to be an Infinite Red client
-
12
Stateful Functions Internals: Behind the scenes of Stateful Serverless A look at how Apache Flink Stateful Functions' runtime enables consistent and fault-tolerant stateful serverless applications 13 Oct 20...
-
7
Python behind the scenes #11: how the Python import system works Published: Tue 13 July 20...
-
5
How React works behind the scenes React is a popular JavaScript library for building user interfaces. It's declarative, efficient, and flexible. But have you ever wondered how React...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK