本文介绍了我怎样才能显示“0个笔记"?在 tumblr 中没有任何笔记时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试了来自不同主题和谷歌搜索的不同代码.尽管所有内容仅在帖子中有注释时才显示通知.
所以当没有笔记时,我想显示0 个笔记" - 我该怎么做
谢谢
解决方案
由于 tumblr 自定义主题文档,但正如我们将看到的,不可能是可能的.
我发明了技巧来帮助您解决问题.
trick 的主要思想是创建特殊的 css class
仅当帖子没有注释 之后,trick 使用伪元素的内容在其中插入必要的文本.notes
帖子块.
技巧要求:只有tumblr标记和css;
Tumblr 标记:
{block:Text}<article class="{block:PostNotes}no{/block:PostNotes}nonotes">…<div class="notes">{block:PostNotes}{贴子}{/block:PostNotes}
</文章>{/块:文本}
一行css:
article .nonotes .notes:before { content: '0 notes';}
I tried different codes from different themes and google search. Though everything just shows a notification only if there are notes in a post.
So when there aren't notes, i wanted to show "0 notes" - How can I do that
Thanks
解决方案
From the first look solution seems to be impossible to output anything if Post has no notes due to tumblr custom themes docs, but as we shall see, the impossible is possible.
I invented trick to help you with your question.
The main idea of trick is to create special css class
only if post has no notes, after it trick is using content of pseudo-elements to insert necessary text in .notes
block of post.
Trick requirements: only tumblr markup and css;
Tumblr markup:
{block:Text}
<article class="{block:PostNotes}no{/block:PostNotes}nonotes">
…
<div class="notes">
{block:PostNotes}
{PostNotes}
{/block:PostNotes}
</div>
</article>
{/block:Text}
One line css:
article .nonotes .notes:before { content: '0 notes'; }
这篇关于我怎样才能显示“0个笔记"?在 tumblr 中没有任何笔记时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!