Can you customize the format of a Tumblr post based on its tag?

笑着哭i 提交于 2019-12-03 17:26:37

You can use {TagsAsClasses}

For example for this tumblr markup:

{block:Posts}
    <div class="entry {TagsAsClasses}">
     Post Content
    </div>
{/block:Posts}

and 3 posts which have this tags:

  1. photo, photo-hi-res
  2. photo, photo-low-res
  3. photo, photography

Tumblr outputs such html markup:

<div class="entry photo photo-hi-res">
 Post Content
</div>
<div class="entry photo photo-low-res">
 Post Content
</div>
<div class="entry photo photography">
 Post Content
</div>

and this markup can be handled with small css:

/* common for photo posts */
.entry.photo {}

/* `hi-res`-tag photo posts */
.entry.photo-hi-res {}

/* `low-res`-tag photo posts */
.entry.photo-low-res { width: 500px; }

/* `photography`-tag photo posts */
/* the rule you need */
.entry.photography { width: 900px; }
.entry.photography img { width: 100%; }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!