Defining style per tags in Tumblr(在 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 中定义每个标签的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Tumblr 中定义每个标签的样式


- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01