I have a content type with the following field:

List (float) - blue - green - yellow

In the view, I want a condition that says that if the value is "blue" display this: div class="blue"

If it is green display class="green"

If it is empty display class ="empty"

And so on...

I tried Views Conditional Module but it can't handle multiple values...

What is the best way to do this?

2 Answers 2


I solved this with a simple solution:

Added custom text field in views and something like: div class="[field_value]"

The result of the field (blue,green,empty) is the class of the div so I can manipulate the css.

Thank you


You can have a look at the module https://www.drupal.org/project/js_injector by which you can add JS snippet in the header or footer of a page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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