Posted by JD on 06/16/07 09:19
Ben C wrote:
<snip good post>
> In fact using a selector rather than inline styles may be a tiny bit
> faster because of the reduced amount of parsing.
>
> A more complex selector like div td div { ... } will be slightly harder
> to match since it's a little bit like an easy version of matching a
> regular expression, but I wouldn't worry about it.
Sort of reminds me of a question I was thinking about recently.
Is 'optimisation' any valid reason to consciously limit the depth of
descendant selectors in CSS? For example, suppose I have a list of links
inside a #navbar div. To style the a elements in the navbar, I could do
this:
#navbar a { ... }
but I prefer to do this:
#navbar ul li a { ... }
just because I find the latter slightly more lucid when reading the
stylesheet.
Is there any circumstance where this coding style could noticeably slow
things down? Or is worrying about this stuff a waste of time because the
speed differences are so negligible?
[Back to original message]
|