How do browsers read and interpret CSS?

前端 未结 7 1199
粉色の甜心
粉色の甜心 2020-12-01 07:59

Two part question:

  1. Do browsers have a built-in CSS interpreter like they do for JavaScript?
  2. When exactly does a browser read the CSS and when does it
7条回答
  •  离开以前
    2020-12-01 08:31

    Yes, browsers have a CSS interpreter built in. The reason you don't "wait until window.onload" is because while Javascript is a Turing-complete imperative programming language, CSS is simply a set of styling rules that the browser applies to matching elements it encounters.

提交回复
热议问题