根据 PageSpeed,我的新 CSS 精灵导航没有使用高效的 CSS 选择器。
有人可以告诉我知道我做错了什么吗?
Very inefficient rules (good to fix on any page):
ul.navmenu li a Tag key with 2 descendant selectors and Class overly qualified with tag
ul.navmenu li.home a Tag key with 2 descendant selectors and Class overly qualified with tag and Class overly qualified with tag
ul.navmenu li.home a:hover Tag key with 2 descendant selectors and Class overly qualified with tag and Class overly qualified with tag
我的 CSS :
ul.navmenu li a { display: block; background: url('/styles/pc-nav-sprite.png'); }
ul.navmenu li.home a { background-position: 0 -486px; width: 187px; height: 24px; margin-top: 16px;}
ul.navmenu li.home a:hover { background-position: 0 -511px; width: 187px; height: 24px; }
HTML:
<ul class="navmenu">
<li class="home"><a class="selected" title="Home"></a></li>
<li class="forum"><a href="/forum/" title="Forum"><span class="displace">Forum</span></a></li>
...
...
</ul>
我将不胜感激这方面的任何帮助。谢谢。