在 Tumblr 中定义每个标签的样式 [英] Defining style per tags in Tumblr

查看:12
本文介绍了在 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 和Chocolate 标签,那么您的HTML 将变为:

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 */
}

更多信息请点击此处http://www.tumblr.com/docs/en/custom_themes

这篇关于在 Tumblr 中定义每个标签的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆