在Tumblr中定义每个标签的样式 [英] Defining style per tags in Tumblr
问题描述
我想知道如何定义特定标签的特定样式。例如,我想让我的帖子呈现一定的风格,如果他们用羊角面包或巧克力标记。
I would like to know how to define the specific style for specific tags. For instance, I would like to have my posts render a certain style if they're tagged with Croissant or Chocolate.
我认为我必须创建一个新类,我知道我必须设计这个新类,但我不知道该怎么做。
I think know I have to create a new class and I know I have to style this new class but I don't know how to do it.
感谢您的协助!
推荐答案
您需要在主题中使用 {TagsAsClasses}
。
You'll need to use {TagsAsClasses}
in your theme.
例如,您需要为您的主题撰写一些内容:
For example, you'll need to write something like for your theme:
<div id="{PostID}" class="post {PostType} {TagsAsClasses}">
<!-- ... -->
</div>
如果您的帖子是照片信息,并有标签Croissant和巧克力, / p>
If your post is a photo post and has the tags Croissant and Chocolate, then your HTML becomes:
<div id="post-26107509778" class="post photo Croissant Chocolate">
<!-- ... -->
</div>
,然后可以为.Croissant或.Chocolate类设置样式:
and then you can set the styles for the .Croissant or .Chocolate classes:
.Croissant {
/* add your styles here */
}
.Chocolate {
/* add your styles here */
}
更多的信息在这里< A HREF =http://www.tumblr.com/docs/en/custom_themes> http://www.tumblr.com/docs/en/custom_themes
这篇关于在Tumblr中定义每个标签的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!