1

I have a View, and when a certain field in the result has a specific value, I want to add a CSS class to that row.

How I can add css class to the matching row in views result in table result mode directly in views pages, without template files?

  • @clive no this is not duplicated, I mean is there any way to achieve this job in views not in template.php???? why you falg as duplicate , do u understand question ???? – Yusef Mohamadi Dec 12 '13 at 7:51
  • 1
    Why did you not say that in your question? You can't do that using just the UI anyway so you'll have to use code. With respect this isn't a very good quality question, you haven't taken much care in explaining your problem, or explained what you've already tried. Could you edit it into shape please? Then if you really want it reopened, already knowing the answer is "you can't" then flag it and I'll do that – Clive Dec 12 '13 at 9:35
8

You can do this in views. The class in views supports tokens. So if you use the value of a field [field_value] and put that in the class, then you can style it by using .field_value in your css.

This way every field will get a class, but only the ones you style in css will affect how they look.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.