The CSS :the place
is similar to the :is
pseudo selector. Which means if we write:
p :the place(.major, .spotlight) {
background-color: yellow;
}
It’s going to function a much less verbose means of writing:
p .major,
p .spotlight {
background-color: yellow;
}
Nevertheless, the distinction between :is
and :the place
is given by the specificity of those selectors.
Whereas :is
has the specificity equal to the selector parameter with the best specificity, the :the place
has zero specificity.
Let’s check out the under code:
kind p, kind #major { coloration: pink }
kind :is(p, #major) {coloration: pink}
kind :the place(p, #major) {coloration: pink}
From a concentrating on viewpoint, all three strains do the identical factor. They set a pink coloration to any p
ingredient or any ingredient with an id of major
that’s set inside a kind.
Hover the distinction is given by the specificity energy of those guidelines:
- the primary two guidelines
kind p
andkind #major
have a specificity of 0,0,2 (two parts) and 1,0,1 (one id and one ingredient) - the second rule kind
:is(p, #major)
comes with a specificity of 1,0,0 (the best handed selector is an id) - and the third rule
kind :the place(p, #major)
has only a specificity of 0,0,1 (solely the shape ingredient is taken into consideration, as:the place(p, #major)
has a zero specificity)