This works expected (order of rules is important here):
---
*[vendor] {
    background-color: rgb(224,224,0);
}
*[vendor="AOL"] {
   background-color: rgb(0,0,192);
}
*[vendor="VFUK"] {
   background-color: rgb(224,0,0);
}
---

Why? because, strangely enough (but this is the CSS spec), "*[vendor]",
"*[vendor="AOL"]" and "*[vendor="VFUK"]" are 3 selectors which all have
the *same specificity*. Therefore if you put "*[vendor]" at last
position, this selector wins.

Paul Moloney wrote:
> One query I hope you could help me with. I thought the following would
> apply the following background colours:
> 
> * Blue, if the vendor attribute is "AOL"
> * Red, if the vendor attribute if "VFUK"
> * Yellow if the vendor attribute is any other value
> 
> However, yellow is applied in all places.
> 
> Do you know how to fix the line marked with the comment?
> 
> -------------------->8----------------------------
> 
> *[vendor="AOL"] {
> background-color: rgb(0,0,192);
> }
> *[vendor="VFUK"] {
> background-color: rgb(224,0,0);
> }
> *[vendor] {    <!-- doesn't work --> background-color: rgb(224,224,0);
> }
> 
> 
> -------------------->8----------------------------

Reply via email to