• Hello,

    Ive searched high and low for this answer and ive had not luck (this may be because it simply isn’t possible).

    I want to style each tag with a different colour with css.

    ***TEMPLATE***
    <span>Tags:</span><?php the_tags('<ul><li>','</li><li>','</li></ul>'); ?>

    ***OUTPUT***
    TAGS: [tag-1], [tag-2], [tag-3], [tag-4], [tag-5], [tag-6] etc…

    ***CSS***

    .tag-1, .tag-4 { color:#ccc; }
    .tag-2, .tag-5 { color:#666; }
    .tag-3, .tag-6 { color:#000; }

    Haw can this be achieved?

Viewing 2 replies - 1 through 2 (of 2 total)
  • That’s not possible, cross-browser, without coding in a unique class for each of the <li> items. Which, in turn, isn’t possible using the_tags().

    Thread Starter David Haigh

    (@david-haigh)

    Thanks for your reply,

    So your saying the only way to do it would be in this list, actually..
    <li style="color:#ccc;"></li>, <li style="color:#666;"></li> ?

    would something work like this.. <li class="<?php (tag_ID) ?>">, <li class="tag_ID"> and it would give each list item its own class?

    I hope I am being clear on what I am trying to achieve.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Styling Tags’ is closed to new replies.