CSS: 256 classes take precedence over id

Today in foreign blogs there was amusing news about the unusual behavior of browsers: the other day Chris Coyier, the author of css-tricks.com showed how a class can be given higher priority than id. You just need to apply 256 classes to the object!

Why does this work?


In Firefox and Chrome, the source code that displays the classes is stored in 8-bit lines , respectively 256 elements go beyond. Opera has 16-bit strings, so 65536 classes are required.

Likewise, 256 nested divs can take precedence over a class.