【发布时间】:2015-02-23 18:17:47
【问题描述】:
我是第一次修改 Tumblr 主题,我想知道是否有一种方法可以显示帖子的数量。第一个帖子是#1,第二个帖子是#2,以此类推?
这可能吗?
【问题讨论】:
我是第一次修改 Tumblr 主题,我想知道是否有一种方法可以显示帖子的数量。第一个帖子是#1,第二个帖子是#2,以此类推?
这可能吗?
【问题讨论】:
遗憾的是,没有主题运算符可以打印出当前的帖子编号,因为 Tumblr 不支持这种逻辑/功能。
但是,你可以伪造它:
CSS
.post:nth-child( 1 ) .number:after {
content: ' 1';
}
.post:nth-child( 2 ) .number:after {
content: ' 2';
}
.post:nth-child( 3 ) .number:after {
content: ' 3';
}
.post:nth-child( 4 ) .number:after {
content: ' 4';
}
.post:nth-child( 5 ) .number:after {
content: ' 5';
}
HTML
<div class="post">
<p class="number">Post</p>
</div>
<div class="post">
<p class="number">Post</p>
</div>
<div class="post">
<p class="number">Post</p>
</div>
<div class="post">
<p class="number">Post</p>
</div>
<div class="post">
<p class="number">Post</p>
</div>
【讨论】: