0

I'm trying to change font color of a specific label. How to apply color depending or based on the text of that label.

I now that we can do:

SPAN.uh[title*="some_text"] 
{ color: white !important; }

Can we do something like this?

#errors > label[text*="NS_ERROR_XPC_GS_RETURNED_FAILURE"]
{ color: LIME !important; }

EDIT: That phrase "NS_ERROR_XPC_GS_RETURNED_FAILURE" is on the stylish manager of the Stylish addon for Firefox, specifically: chrome://stylish/content/edit.xul

How can I hide that phrase?

Sam-Bo
  • 779
  • 1
  • 7
  • 11
  • Unfortunately, there's no content selector in CSS (at least at the moment). – Hashem Qolami Aug 23 '14 at 18:51
  • 1
    As long as you have control over the content, the answer lies in your question: As Hashem sayd, there is no content selector, but you could define a `data-text` attribute containing the same content. Then you could match it using `[data-text*="..."]`. – try-catch-finally Aug 23 '14 at 18:56

1 Answers1

1

jQuery's selector engine has a selector for content, :contains(), but native CSS does not.

$('label:contains('some text')').css('color','Lime'); - jsFiddle Example

Brian Dillingham
  • 9,118
  • 3
  • 28
  • 47