JTheboss JTheboss - 1 month ago 13
CSS Question

What's the difference between these css selectors?

What is the difference between this four css selectors

x y
.x y
.x .y
.x.y

Answer

x y doesn't really exist, except if you create html tags <x> and <y>, then it would address all <y> tags inside <x> tags

.x y: similar - if, then it would address all <y> tags inside tags that have class x

.x .y addresses all tags with class y inside tags that have class x

.x.y addresses all tags that have both class y and x