On Sat, 28 Aug 2010, Ville Viklund wrote:

I have a question about efficient selectors. I tried Page Speed extension for Firebug which analyzed use of efficient CSS selectors among lots of other things. Page Speed considered longer(#header ul li a) selectors inefficient and recommended to fix them.

Is there a good reason to use this kind of selector "#header ul li a {...", instead of just "#header li a"? Is it considered best practice, or why this is so commonly used?

   I doubt that the difference in speed would be significant, but I'd
   use the shorter one on principle.

   The longer version can be used if you need extra specificity for
   this rule.

--
   Chris F.A. Johnson, <http://cfajohnson.com>
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
______________________________________________________________________
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to