Skip to content

Commit

Permalink
Update notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cssmagic committed Sep 16, 2017
1 parent 5b23c4e commit 914efeb
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions notes/chapter-4/405.md
Expand Up @@ -21,3 +21,26 @@ issue: 58
本书作者 Lea Verou 似乎对 Stylus 成见颇深。她曾 [在 Twitter 上表示](https://twitter.com/leaverou/status/561678335731044353),她不喜欢 Stylus 是因为 “它的语法最不像 CSS”(但实际上 Stylus 完全支持 CSS 语法),而且 “社区很小”(唉,真是势利啊……)。

是的,魔法哥是 Stylus 铁粉。

## 交流与答疑

#### 第 107 页 ‧ 第一段

> 色标的位置值将变成 ![{2 \over \sqrt{2}} = \sqrt{2} \approx 1.414213562](http://latex.codecogs.com/gif.latex?{2%20%5cover%20%5csqrt{2}}%20%3d%20%5csqrt{2}%20%5capprox%201.414213562),我们可以将其取整为 `1.5em`……
图灵社区网友 [@黄昏雨长相忆](http://www.ituring.com.cn/space/271126) 反馈,用 Chrome 浏览器查看书中提供的 [在线演示](http://play.csssecrets.io/folded-corner) 时,折角大约有 0.2em 错位。

实际上,这种计算误差所引起的渲染误差在各个浏览器上都存在,不光光是 Chrome 的问题。在视网膜屏幕上,这个误差看起来可能更加明显。问题就出在 1.414213562 与 1.5 之间的误差上。

作者最终给出的代码是这样的:

> ```css
> background:
> ...
> linear-gradient(-135deg,
> transparent 1.5em, #58a 0);
> ```
如果把最后一行代码中的 `1.5em` 改成 `1.414em`,基本上就可以消除这个渲染误差了。

我不知道作者为什么要把这个值 “取整” 为 `1.5em`,不过我也并不纠结,毕竟我们看书是为了 get 新技能,不需要在意这些细节。

0 comments on commit 914efeb

Please sign in to comment.