0

Possible Duplicate:
Why do browsers match CSS selectors from right to left?

I've heard browsers read css selectors from right to left. So if we write like this;

#block1 a{text-decoration:none;} 

browsers find first, all a tag then find block1 and performance drops a bit. Is it true?

Community
  • 1
  • 1
regxcode
  • 413
  • 3
  • 9
  • 14
  • 4
    Yes... http://stackoverflow.com/questions/2327009/in-which-direction-are-css-selectors-matched http://stackoverflow.com/questions/5797014/why-do-browsers-match-css-selectors-from-right-to-left – BoltClock Nov 03 '12 at 09:10
  • a) That depends on the browser, b) why would performance drop a bit and if so, what are you going to do with that information? – deceze Nov 03 '12 at 09:13
  • well, what is true usage of it. Like this? a #block1{text-decoration:none;} ?? – regxcode Nov 03 '12 at 09:13
  • 2
    True usage has nothing to do with performance. You either use it a certain way or you don't. – BoltClock Nov 03 '12 at 09:14
  • `a #block1` is something entirely different than `#block1 a`. How browsers evaluate CSS is an irrelevant internal detail, it doesn't change how CSS and selector rules works. – deceze Nov 03 '12 at 09:15
  • 2
    @dystroy: I meant in general. Whether that is still true I have no idea because I'm not an implementer, but what I do know is that there are many optimizations that are employed beyond the general RTL matching algorithm, and that **none of this should matter to authors at all**. – BoltClock Nov 03 '12 at 09:15
  • 2
    I found an article on the subject https://developer.mozilla.org/en-US/docs/CSS/Writing_Efficient_CSS?redirectlocale=en-US&redirectslug=Writing_Efficient_CSS – regxcode Nov 03 '12 at 09:35

0 Answers0