Changing a tag with multiple style definitions?

edited August 2007 in Style Development
I know how to change when there's only one definition.

But now I have this one:


div[style="background-color:#EAD045; color:#EAD045;"]

doesn't work.

How do I get this to work?


  • it should work, are you adding !important to the declaration? {color:red!important}
  • You have to exactly match the attribute value, including whitespace and capitalization. Not saying that that's your problem, but it's something that could trip you up.
  • I copy-pasted it exactly.

    This is how it looks, but it won't work. :/

    div[style="background-color:#EAD045; color:#EAD045;"] {
    background-color: #CCCCCC !important;
    color: #CCCCCC !important;
  • Can you give a link to the page you're applying this against?
  • Jason is right. You have to match the attribute value exactly according to how the browser represents it. You have to use Firebug/DOMi/whatever.

    div[style="background-color: rgb(234, 208, 69); color: rgb(234, 208, 69);"]
  • No, it's the text of the attribute that matters, not how the browser stores it internally or decides to represent it elsewhere. Viewing the source is normally enough.

    What could be happening, however, is that the site is changing the style via setAttribute, so while the source says something, the actual value of the attribute is something else.
  • You can try it out for yourself on the following div:

    The following will select the element:
    div[style="background-color: rgb(234, 208, 69); color: rgb(234, 208, 69);"]
    The following will not select the element:
    div[style="background-color:#EAD045; color:#EAD045;"]
    This is an issue related to Gecko, not Stylish. Adblock Plus shows the same symptom when it applies its stylesheet.
  • Hm, strange. True.

    But thanks all. :) Setting the RGB values worked!

    Just a Q.. When there are multiple styles w/o any color (like border, or width) I can just paste it? This only applies to colors?
Sign In or Register to comment.