I want to add a random class name from (class1, class2, class3, class4) to #tagcat element.
How can I do that? Is it possible to do this without javascript?
<b:if cond='data:top.showPostLabels and data:post.labels'>
<b:loop index='i' values='data:post.labels' var='label'>
<b:if cond='data:i == 0'>
<div class='alt-cat blurple-gradient' id='tagcat' title='ds'>
<a expr:href='data:label.url' rel='tag'>
<data:label.name/>
</a>
</div>
</b:if>
</b:loop>
</b:if>
</div>
EDIT
That is the complete code that shows the recent 8 posts on the home page of my blog:
<div class='entry-content' expr:id='"post-body-" + data:post.id' expr:itemprop='(data:blog.metaDescription ? "" : "description ") + "articleBody"'>
<b:if cond='data:blog.pageType == "item"'>
<data:post.body/>
<b:else/>
<b:if cond='data:blog.pageType == "static_page"'>
<data:post.body/>
<b:else/>
<div class='post-media'>
<b:if cond='data:post.firstImageUrl'>
<div class='image-wrap'>
<!-- <div class='mask'/> -->
<a expr:href='data:post.url'>
<img expr:alt='data:post.title' expr:src='data:post.thumbnailUrl' />
</a>
</div> <b:else/>
<div class='needo' /> </b:if>
<script class='java' expr:src='"/feeds/posts/default/" + data:post.id + "?alt=json-in-script&callback=labelset"' type='text/javascript' />
<b:if cond='data:top.showPostLabels and data:post.labels'>
<b:loop index='i' values='data:post.labels' var='label'>
<b:if cond='data:i == 0'>
<div class='alt-cat blurple-gradient' id='tagcat' title='ds'>
<a expr:href='data:label.url' rel='tag'>
<data:label.name/>
</a>
</div>
</b:if>
</b:loop>
</b:if>
</div>
<div class='post-body'>
<div class='post-title'>
<h2>
<a expr:href='data:post.url'><data:post.title/></a>
</h2>
</div>
<div class='post-entry'>
<p><data:post.snippet/></p>
</div>
<div class='post-author'>
<!--
<div class='image-thumb'>
<img alt='Post Author' expr:src='data:post.authorPhoto.url'/>
</div>
-->
<div class='name-author'>
<data:post.author/>
<div class='time-stamp'>
<data:post.timestamp/>
</div>
</div>
</div>
The element #tagcat
displays the label. I want to add different classes on element #tagcat
for different posts so that they appear in different colors,
so I need different CSS for different post snippets label.
Why not using post label name in class and style each label with css
<div expr:class='data:label.name' id='tagcat' title='ds'>
CSS
.label-name { color: your color }