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