Midday Latte

'Tis I, House! I'm a happy designer-type.
Twitter  /  FB  /  Dribbble 

Tumblr Themes: How to Render Tags in a Comma Separated List

This is a quick tutorial on displaying tags on your Tumblr in a comma-separated list. I was prompted to share these instructions by Dorijan Covran, who wrote in to inquire about my method:

I recently started modifying a Tumblr theme and want to achieve a similar layout of tags like in your Midday Latte blog. Could you share some insights or code to achieve this?

For this example, I’m using the HTML straight out of the custom theme documentation.

{block:HasTags}
  <ul class="tags">
    {block:Tags}
    <li><a href="{TagURL}">{Tag}</a></li>
    {/block:Tags}
    </ul>
{/block:HasTags}

Without any styling, the above generates a bulleted list of the tags for that post, with each linking to a tag page. Something like this:

Hooray! Appropriately semantic. From here, I can use my stylesheet to do the rest of the work. The following CSS resets browser defaults for unordered list items, floats each one left so the list is inline, and adds commas (except for on the last item).

.tags li {
  padding: 0;
  margin: 0;
  list-style-type:none;
  display: block;
  float: left;
  }

.tags li:after { 
  content: '\002C\00a0';    /* Add comma and space after each tag */
  }  

.tags li:last-child:after {
  content: ' ';    /* Eliminate comma after last tag */
  } 

Here’s what those additions produce. Ta-da! A comma-separated tag list.

One last note—if you want to add the number symbol (#) before each tag so that they look like hashtags (like #ui, #wireframes, #planning), just add this declaration to your CSS:

.tags li:before { content: '#'; }

Tumblr Themes: How to Add Fluid Width Video

If you want to expand your YouTube, Vimeo, and other embedded videos out of the 500-pixel wide Tumblr standard and make them scale fluidly, this post is for you. These instructions assume you’re familiar with CSS and customizing Tumblr themes.

Here’s the problem—when you use the {Video-500} variable, your video will come with fixed width and height attributes. Unlike images, you can’t resolve this problem with a simple max-width:100% declaration because the height won’t resize proportionally. You’ll end up with a really wide, short video. This solution will always present your video with a 4:3 ratio, even as the containing element is resized. (See here for an example of the fluidity at work.)

In your HTML…

When setting up your {block:Video} block, make sure your {Video-500} variable is in a container <div> with a class name. I’m going to use media. Here’s the example.

<div class="media">{Video-500}</div>

In your CSS…

Add the following rules to your stylesheet. (If you used a different class name for your video container, replace media with that.)

.media {
  position: relative;
  padding-bottom: 75%;
  height: 0;
  overflow: hidden; 
  }

.media iframe, .media object, .media embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  }

Note that padding-bottom:75% results in a video height that is 75% of the video width—in other words, the video is displayed with a 4:3 ratio. Feel free to adjust this number if you’re posting video in another aspect ratio.

Update: A really neat jQuery plugin was just called to my attention—FitVids.js facilitates fluid width video and gives you perfect aspect ratio. (Thanks for the tip, Rogie!) Also, I almost forgot to note—this solution was adapted from this post on elastic video.

From my shot on Dribbble:

This is a video tutorial of my process for creating pixel portraits like this and this in Photoshop. I only recently started making these portraits so I’m no pro, but I hope those who asked for a tutorial will find this helpful all the same. I tried to make this super-simple so even non-Dribbblin’ beginners can follow along.

I’m glad I can finally post the finished product—it took a surprisingly long time to put this together! Thanks to all-around awesome guy Tyler for letting me borrow his avatar.