idea css错误_CSS错误处理

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 20:14   1258   0

idea css错误

CSS is resilient. When it finds an error, it does not act like JavaScript which packs up all its things and goes away altogether, terminating all the script execution after the error is found.

CSS具有弹性。 当发现错误时,它不会像JavaScript那样打包所有内容并完全消失,从而在发现错误后终止所有脚本执行。

CSS tries very hard to do what you want.

CSS会竭尽所能。

If a line has an error, it skips it and jumps to the next line without any error.

如果一行有错误,它将跳过该行并跳至下一行,而不会出现任何错误。

If you forget the semicolon on one line:

如果忘记一行中的分号:

p {
  font-size: 20px
  color: black;
  border: 1px solid black;
}

the line with the error AND the next one will not be applied, but the third rule will be successfully applied on the page. Basically, it scans all until it finds a semicolon, but when it reaches it, the rule is now font-size: 20px color: black;, which is invalid, so it skips it.

出现错误的行,并且不会应用下一条,但是第三条规则将成功应用到页面上。 基本上,它会扫描所有内容,直到找到分号为止,但是当到达分号时,规则就是font-size: 20px color: black; ,这是无效的,因此将其跳过。

Sometimes it’s tricky to realize there is an error somewhere, and where that error is, because the browser won’t tell us.

有时,由于浏览器不会告诉我们,很难意识到某个地方的错误以及该错误的位置。

This is why tools like CSS Lint exist.

这就是为什么存在CSS Lint之类的工具的原因。

翻译自: https://flaviocopes.com/css-error-handling/

idea css错误

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP