xxleyi / learning_list

聚集自己的学习笔记
10 stars 3 forks source link

CSS Key Concepts #231

Open xxleyi opened 4 years ago

xxleyi commented 4 years ago

CSS 大全:CSS: Cascading Style Sheets | MDN


前端程序员在处理 CSS 时,很容易产生这样一种微妙的心理:一方面看不上 CSS,因为它就是用来指定下页面样式;另一方面又时常受折磨,觉得 CSS 一团糟,各种 issue 不断,打心底里觉得根本无法像理解 JS 一样去理解 CSS,只求能把想要的样式搞出来。尽快脱离苦海。

CSS 的重难点是向后兼容,简单属性背后的复杂概念模型,以及属性之间不一定正交,会耦合,会多个属性协同工作。

但 CSS 本身绝对是可以理解的

在这段集中学习 CSS 的时间里,我慢慢有一些体会,简单总结如下:

以上是我个人总结,下面是 MDN 列出的关键概念

xxleyi commented 4 years ago

Calculating a property's actual value

The user agent performs four steps to calculate a property's actual (final) value:

  1. First, the specified value is determined based on the result of cascadinginheritance, or using the initial value.
  2. Next, the computed value is calculated according to the specification (for example, a span with position: absolute will have its computed display changed to block).
  3. Then, layout is calculated, resulting in the used value.
  4. Finally, the used value is transformed according to the limitations of the local environment, resulting in the actual value.
xxleyi commented 3 years ago

image