Tumblr 上每个标记页面的不同样式 [英] Different style per tagged page on Tumblr
问题描述
我正在尝试更改 Tumblr 上标记的页面的样式(如在收集所有特定标记的页面中 - 对于 示例).目前所有标记的页面看起来都一样.这是我使用的代码 -
I'm trying to change the style of a tagged page on Tumblr (as in the page that collects all the specific tags - for example). At the moment all the tagged pages look the same. This is the code I've used -
{block:TagPage}
<div id="sp">
<div class="container">
<div class="row">
<h1 class="main-logo"><a href="/">
<img src="http://static.tumblr.com/bw1wxme/p5cn7shd5/logo_web.png" alt="" />
</a></h1>
</div><!-- row -->
</div><!-- /container -->
</div><!-- /portrwrap -->
{/block:TagPage}
我正在尝试为某个带标签的页面使用不同的背景.例如,当您访问/tagged/shows 页面时,它的背景与/tagged/news 页面不同.
I'm trying to use a different background for a certain tagged page. For example, when you visit the /tagged/shows page, it has a different background to the /tagged/news page.
与 Wordpress 不同,我一直无法找到页面 ID.我查看了 this 但这只会改变帖子的风格,而不是标记页面.
Unlike Wordpress, I've been unable to find a page ID. I looked into this but that only changes the style of the post, not the tagged page.
推荐答案
您可以根据当前标签在 body 元素上设置一个#id":
You could set an '#id' on the body element, based on the current tag:
<body {block:TagPage}id="{URLSafeTag}"{/block:TagPage} />
...
</body>
当您访问标记页面时,tagged/news/
HTML 将呈现如下:
When you visit a tagged page, tagged/news/
the HTML will render like so:
<body id="news" />
...
</body>
这样您就可以更改页面上的所有元素,例如导航.
That way you can change all elements on the page, such as the navigation.
#news #nav {
background-color: red;
}
希望有帮助!
参考:https://www.tumblr.com/docs/en/custom_themes#tag-pages
这篇关于Tumblr 上每个标记页面的不同样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!