Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am trying to have all my taxonomy terms to look different from each other.

Is there a way for me add specific CSS classes to differing taxonomy terms?

share|improve this question
    
possible duplicate of Add class to taxnonomy term in view –  Krishna Mohan Mar 24 at 9:13
    
where you want this class added ? in views? node? where? –  zhilevan Aug 30 at 8:01

3 Answers 3

If you want add class to term in everywhere I suggest customize taxonomy template with taxonomy-term.tpl.php. This will allow you to customize the output of your term page.

also if you want to add class to it in views result use Field Formatter CSS Class module is what you're looking for.

Adds a formatter for text/list/taxonomy fields to render as CSS classes on nodes.

The Field formatter CSS class module allows you to set any text/list/option/taxonomy field to render as CSS class on the node. This enables the node author to select predefined CSS styling per node.

share|improve this answer

Already the page-taxonomy-term-TERM_ID is present on the body tag.

To add more classes you can use hook_preprocess_html() and add the $vars['classes_array'] to add the css classes you want for the terms.

share|improve this answer

Are you talking about taxonomy pages? If so you can target each one of them with the default body class "page-taxonomy-term-X" where X is the taxonomy id.

If you want a different class, I suggest you to use the context module

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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