👏 Attribute selectors are great. I once wrote a small post on using them to handle responsive styling (shameless self-promotion 😉)
One small thing regarding multiple modifiers. The syntax should be ~= to avoid value name collisions e.g.
~=
[data-color*="lightgray"] { color: whitesmoke; } [data-color*="gray"] { color: gray; }
<input data-color="lightgray" /> <input data-color="gray" />
Both input will turn out gray because gray is found in both lightgray and gray
If you use ~= (exact word match) you avoid this problem
[data-color~="lightgray"] { color: whitesmoke; } [data-color~="gray"] { color: gray; }
Thanks for sharing
Thanks! You're right about multiple modifiers, of course – I'll update the Pens.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
👏 Attribute selectors are great. I once wrote a small post on using them to handle responsive styling (shameless self-promotion 😉)
One small thing regarding multiple modifiers. The syntax should be
~=
to avoid value name collisions e.g.Both input will turn out gray because gray is found in both lightgray and gray
If you use
~=
(exact word match) you avoid this problemThanks for sharing
Thanks! You're right about multiple modifiers, of course – I'll update the Pens.