< img src ="https://websitedesign-usa.com/wp-content/uploads/2021/05/lets-utilize-x-x-x-x-for-discussing-uniqueness.jpg" class ="ff-og-image-inserted"> I was simply talking with Eric Meyer recently and I kept in mind an Eric Meyer story from my developmental years. I composed a post about CSS uniqueness, and Eric made the effort to explain the deceptive nature of it (I keep in mind scooting to upgrade it). What was so deceptive? The method I was representing uniqueness as a base-10 number system.
State you pick a component with
ul.nav. I insinuated in the post that the uniqueness of that selector was 0011 (eleven, basically), which is a number in a base-10 system. I was stating tags = 0, classes = 10, IDs = 100, and a design characteristic = 1000. If uniqueness was determined in a base-10 number system like that, a selector like
ul.nav.nav.nav.nav.nav.nav.nav.nav.nav.nav.nav (11 class names) would have an uniqueness of 0111, which would be the exact same as
ul #nav. leading. That’s not real. The truth is that it would be (0, 0, 11, 1) vs. (0, 1, 0, 1) with the latter quickly winning.
That comma-separated syntax like I simply utilized fixes 2 issues:
- It does not insinuate a base-10 number system (or any number system)
- It has a legible and unique appearance
I like the (X, X, X, X) appearance. I might see restricting it to (X, X, X) considering that a design quality isn’t precisely a selector and generally isn’t discussed in the very same type of discussions. The parens make it more clear to me, however I might likewise see a X-X-X (dash-separated) syntax that would not require them, or a (X/ X/ X) syntax that most likely would take advantage of the parens.
Anyhow, obviously I get the bug to discuss this every half-decade or two.