优化css vs Google页面速度正在弄乱我 [英] Optimize css vs Google page speed is messing with me
问题描述
我使用的是Google网页速度,它告诉我我的CSS效率不高...
效率很低的规则(很好地修复任何页面) p>
* table.fancy thead td带有2个后代选择器的标签键和带有标签的类overly qualified
* table.fancy tfoot td具有2个后代选择器的标签键和具有标签
$ b
的标准
table.fancy {border:1px solid white; padding:5px}
table.fancy td {background:#656165}
table.fancy thead td,table.fancy tfoot td {background:#767276}
我希望页眉和页脚的背景颜色不同于表格的主体(数据表)
- 这是什么原因导致效率低下?
- 如何提高效率?
我不会为google和tfoot添加类。 Google的网页速度说,指定2个后代是低效的,这可能是真的,但我怀疑它将对最终用户的体验产生任何影响。另一方面,有时你必须使用这种方式做你想要的。其他时候,这是一个让CSS更容易阅读和维护的问题。
最终它是你的CSS,所以做你想要的。我不认为微优化会很重要。
另请参阅:此问题
I'm using google page speed and it's telling me my css is inefficient...
Very inefficient rules (good to fix on any page):
* table.fancy thead td Tag key with 2 descendant selectors and Class overly qualified with tag
* table.fancy tfoot td Tag key with 2 descendant selectors and Class overly qualified with tag
The css rules are
table.fancy {border: 1px solid white; padding:5px}
table.fancy td {background:#656165}
table.fancy thead td, table.fancy tfoot td {background:#767276}
I want the header and footer in a different background color than the body of the table (a data table)
- On what grounds this is inefficient?
- How to make it more efficient?
I will not add a class to the thead and tfoot for googles's sake.
Google's page speed says that specifying 2 descendants is inefficient, which may be true, but I doubt it'll make any difference on the end-user's experience. On the other hand, sometimes you have to use this way to do what you want. Other times, it's a matter of making the CSS easier to read and maintain.
Ultimately it's your CSS, so do what you want. I don't think that micro-optimization will matter.
See also: this question
这篇关于优化css vs Google页面速度正在弄乱我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!