0

For Chartist line graphs, I'm trying to do conditional coloring of points via CSS. The value that determines the color is the ",0" on the ct:value attribute, as follows:

<line x1="555" y1="317.2833251953125" x2="555.01" y2="317.2833251953125" class="ct-point" ct:value="63624984960667,0"></line>

What attribute selector can we use that styles all line elements such that ct:value contains ",0"?

I've attempted the following without success:

line[ct\:value~=",0"] {
    //etc
}

UPDATE: Modified original code to show tilda (~) instead of caret (^).

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Savage
  • 2,296
  • 2
  • 30
  • 40
  • Possible duplicate of [Selecting an element by its attribute when it has a colon in its name](http://stackoverflow.com/questions/34446361/selecting-an-element-by-its-attribute-when-it-has-a-colon-in-its-name) - like yours, that question also involves Chartist XML. – BoltClock Mar 13 '17 at 11:11

1 Answers1

1

The attribute matching expression, val^="attribute" means the attribute has to start with attribute, not just contain it. You want *= instead for just matching somewhere in the string:

line[ct\:value*=",0"] {
   ...
Tashi
  • 180
  • 1
  • 8
  • You're right, but I looked at the original code and it was actually using tilda (~) - I'll update my question. So the problem seems to be with the selector or the escape character. – Savage Mar 13 '17 at 11:06
  • 1
    Sorry, it's `*=`, not `~=`! The "tilde-equals" method only does either full matches or whitespace-separated matches. – Tashi Mar 13 '17 at 11:21