简体   繁体   English

浏览器如何呈现HTML和CSS

[英]How does the browser render HTML and CSS

If I have the following HTML div element: 如果我有以下HTML div元素:

<div id="outer-div" style="Certain-Style"> 

<div id="inner-div">
</div>
....
</div>

Then how the browser will implement/render these HTML elements? 那么浏览器将如何实现/渲染这些HTML元素? Does it start with outer div then inner div then go back to apply the CSS of outer-div then the CSS of inner-div ? 它是否从外部div开始,然后是内部div,然后返回以应用outer-div的CSS,然后再应用inner-div的CSS?

Let us imagine that the style Certain-Style rotates the inner div by 90-degree clock-wise. 让我们想象一下, Certain-Style会将内部div顺时针旋转90度。 The inner-div is an angularjs directive that displays other items according to the inner-div width. inner-div是angularjs指令,可根据inner-div宽度显示其他项目。 Does the rotation starts first then building the directive or it starts with building the directive then rotates? 旋转是先开始然后构建指令,还是先构建指令然后旋转?

Here's a quick recap of the browser's steps: 以下是浏览器步骤的快速回顾:

  1. Process HTML markup and build the DOM tree. 处理HTML标记并构建DOM树。
  2. Process CSS markup and build the CSSOM tree. 处理CSS标记并构建CSSOM树。
  3. Combine the DOM and CSSOM into a render tree. 将DOM和CSSOM合并到渲染树中。
  4. Run layout on the render tree to compute geometry of each node. 在渲染树上运行布局以计算每个节点的几何形状。
  5. Paint the individual nodes to the screen. 将各个节点绘制到屏幕上。

My source is the developers.google. 我的来源是developers.google。 Below is the link for more details. 以下是更多详细信息的链接。

Render-tree Construction, Layout, and Paint 渲染树的构造,布局和绘制

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM