On Sun, Jan 2, 2011 at 10:57 PM, Thierry Koblentz
<thierry.koble...@gmail.com> wrote:

> Why going through so many elements? It can't be good regarding performance
> and it increases specificity for no reason.
>
> I'd go with a simple:  #last {...}

Point accepted. In general, one should keep selectors as simple as
possible, with just as much specificity as one needs.

However, in this case, #last{...} does *not* work see:
http://roughtech.com/t/polar.html
The selector #mainmenu li has to be overridden.

Also, I personally prefer to prefix id selectors with the element
name. This makes it easier for me to read and understand a stylesheet,
I wont have to constantly refer to the html file. For example, I
prefer li#last over #last because at a later time I would know, with
one glance, that the id is on an <li>.

Another thought: Is #last really faster than #container #mainmenu ul
li#last ? It appears to me that the latter should be faster because
the browser does not have to traverse the entire DOM tree looking for
#last, it can just start from #container.

~Chetan
______________________________________________________________________
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