Reputation: 33
I'm just working on a email html template and I came across this:
*[class=width100pc] { width: 100% !important; }
I've never seen something like this before. Is there a reason of using this syntax for selecting by class instead of just using
.width100pc {width: 100% !important;}
I know that CSS is kind of limited in email clients, is it somehow related to it?
Upvotes: 0
Views: 72
Reputation: 21672
You would use *[class=width100pc]
to style any element where width100pc
is the only class.
*[class=width100pc] { color: red; }
<div class="width100pc">Hello</div>
<div class="width100pc another-class">world!</div>
A standard class selector will apply regardless of other classes.
.width100pc { color: red; }
<div class="width100pc">Hello</div>
<div class="width100pc another-class">world!</div>
Upvotes: 1
Reputation: 323
The one reason that comes to my mind is when class selector is not supported in a specific environment where this code is used, but can be bypassed by using attribute selector.
Upvotes: 0