0

我使用谷歌网页速度,它告诉我我的CSS是无效的......优化CSS VS谷歌网页速度与我搞乱

非常低效的规则(良好的修复任何页):

* 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 

CSS规则是

table.fancy {border: 1px solid white; padding:5px} 
table.fancy td {background:#656165} 
table.fancy thead td, table.fancy tfoot td {background:#767276} 

我想在不同的背景颜色比表的主体(数据表)

页眉和页脚
  • 究竟是什么原因导致效率低下?
  • 如何让它更有效率?

我不会添加一个类到thead和tfoot为谷歌的份上。

回答

2

谷歌的页面速度说明指定2个后代是低效的,这可能是事实,但我怀疑它会对最终用户的体验产生任何影响。另一方面,有时你必须用这种方式去做你想做的事。其他时候,这是让CSS更易于阅读和维护的问题。

最终它是你的CSS,所以做你想要的。我认为微型优化不重要。

另请参阅:this question

+0

好的,螺丝谷歌:-) – 2010-04-11 06:39:34