Stylish Thumbs and Navigation

On the last post I had decided to do something I do occasionally, embed some thumbnails from the photolog in a relevant post. While I was writing the post I thought to myself, “Man this thumbnails are going to look funky, I should center them with <p align="center">.”

Blasphemy! I know. Forgive me, I was tired. Still, align="center"? That is so last decade. So I decided to give the paragraph a little class, postthumbs, which to me describes the content of the paragraph and is something I could see myself reusing. What follows is trying to add a little style to some simple thumbnails.

I’m a fan of the double border look for thumbnails, a thick white border surrounded by a very thin darker border. You see it done all the time, for example Rannie and Christine, but in both cases the border is actually part of the image itself.

This is cumbersome for several reasons. First, this may be geeky of me, but it seems like it’s violating the principle of separating content (the thumbnail or picture) and the presentation (the border). In addition this technique is rather inflexible. If Rannie decided tomorrow that he wanted orange and green borders instead of the white and black ones he has now he would have to regenerate every single thumbnail. Since I suspect both Christine and Rannie do this effect in Photoshop, this is a pain however you cut it, even with heavy batch action.

So the solution is CSS. If you remember the box model you’ll see that this effect should be rather easy. We can just put a background on the element and it will show through on the padding, then the border goes outside that, creating the effect of a double border.

How I do these sort of things is I create an HTML file on my desktop with the generated code from whatever page I’m working on and then I use it as the preview in the excellent TopStyle 3.1 so I can see whatever changes I’m making to the design live. In my opinion this is the only way to design with CSS. The only downside is right now I can only preview things in Internet Explorer because the Mozilla object it calls doesn’t seem to work quite right with 1.5 betas. However for most projects getting it working in IE first is the most realistic thing to do.

So let’s take a look at the code we’re going to be styling:

<p class="postthumbs"><a href="/p/9-9-2003/DSC06440"><img src="/a/9-9-2003/DSC06440.thumb.jpg" alt="The front of my new business card." /></a> <a href="/p/9-9-2003/DSC06439"><img src="/a/9-9-2003/DSC06439.thumb.jpg" alt="The back of my new business card" /></a></p>

So my first inclination was to apply the background and border to the anchors (the <a> element). After playing with the colors for a bit here’s what I ended up with:

.postthumbs {
  background: #eef5c5;
  border: 1px solid #e7f3a5;
  border-left: none;
  border-right: none;
  text-align: center;
}
.postthumbs img {
  padding: 6px;
}
.postthumbs a {
  background: #fff;
  border: 1px solid #cde44e;
}
.postthumbs a:hover {
  border: 1px solid #8a9f18;
}

It did exactly what I was looking for in the preview, and it allowed plenty of flexibility and did exactly what I wanted to do. Let’s talk a little about what the above code does. The first class is for styling the entire paragraph, which fills up all the horizontal space available to it. The first rule gives the whole thing a background, the second rule puts a one pixel solid border on all sides, and then the third and forth rules remove the border from the left and right side. Finally we say to center everything. Occasionally I’m asked why I apply the border to all sides and then remove it instead of just having simply border-top and border-bottom rules. The simple answer is then whenever I changed the color or thickness or style of the border I would have to change it in two places, and this way I only have to change it in one place. I think it’s roughly the same number of characters too.

The second selector says that any images inside of anything with a class of “postthumbs” should have 6 pixels of space around it. Then the next two apply the white background and a border that changes when you hover over the anchor.

We’re done, right? Not quite. As soon as I loaded it up in Mozilla I noticed that the white background and border were, for lack of a better term, bunched up at the bottom. I suspect that for some reason that where Internet Explorer put the anchor “box” around the entire image Mozilla just put the box around what looked like where it would be if there was text there, so the font size (12 pixels) plus the line height. Generally in cases like this I assume Mozilla is right and IE is just being overly forgiving, so I find a workaround. I’d like to find the exact reason for this behaviour, but I don’t have a lot of time right now and the Mozilla Bugzilla interface is so painful.

So the previous method looks funky in Mozilla, but a solution quickly came to mind. If I put the padding, border, and all on the image then that should avoid all problems. I could even keep the hover psuedo-class on the image even though IE users wouldn’t see the effect. Here’s the final code:

.postthumbs {
  background: #eef5c5;
  border: 1px solid #e7f3a5;
  border-left: none;
  border-right: none;
  text-align: center;
}
.postthumbs img {
  background: #fff;
  border: 1px solid #cde44e;
  padding: 6px;
}
.postthumbs img:hover {
  border: 1px solid #8a9f18;
}

As you can see this is a bit less verbose and generally simpler to understand. What we have is a consistent look in IE and Mozilla and enhanced functionality in more technologically advanced browsers, which is something I’m perfectly comfortable with.

In other news the links on the page are no longer bruised blue and purple, but rather some shades that I think match better. I’m a big fan of :visited link states as it can be very useful when browsing and is also interesting to see links you’ve already visited on other sites. I usually make visited links a little darker, which seems to delineate them clearly. Another common technique I’ve seen before is to not have visited links underlined, which I think is also nifty. However sometimes I see :visited states on site navigation, where it is nearly useless.

Navigation has started to flesh itself out, but it still has a long way to go. I’m going to have to reevaluate the site’s information architecture and reassess what sections could be combined and which need to be retired. There is also the question of what to do with all the contemporaria I kept in my sidebar before, and I’m not quite sure yet. I think maybe a nested sidebar that you can turn on but is off by default. I’m using these changes to give Dreamweaver MX 2004 a solid run-through and so far I’ve been very satisfied. It’s nothing revolutionary, and many of the new features they’ve been pushing don’t really appeal to me, but it has the polish of a mature product that I feel comfortable spending a lot of time in. I would have called it 6.5, but then again over at WordPress we put major functionality upgrades and changes in to hundredth point upgrades.

Today the Jetpack plugin turns five years old. Who woulda thunk it? It’s one of the most popular plugins in WP history, and sites that include it as part of their WordPress install are more likely to to have engaged and active users — we’ve even seen it reduce churn on major web hosts. While there’s been a lot that’s happened in the Jetpack plugin so far, what’s around the corner has me even more excited. 😀 🚀 P.S. Check out that new domain.

Account for Externalities

When I studied economics, one of the concepts that struck me the most was the concept of externalities. This International Monetary Fund post explains it well. In short, externalities are costs or benefits of an economic activity that affect third parties who did not choose to incur them, leading to a divergence between private and social costs or benefits. They’re spillover effects—positive or negative—that the market price fails to reflect. A classic example is air pollution from a factory, where nearby residents bear health and environmental costs not included in the price of the factory’s products.

Open source is full of externalities. On the positive side, adoption creates ecosystems of developers and provides many paths of distribution. On the negative side, there’s often underinvestment in the very projects that sustain the ecosystem. I have a lot of empathy for why, when open source meets finance and private equity, things can go sideways. You can look at a business built on open source and see seemingly amazing margins—efficient R&D that compounds in a DCF model. A percent here or there over many years really adds up.

My plea to investors in open-source businesses is this: when a business is built on top of open source, incorporate a restorative investment percentage back into the projects critical to the end-user experience of what you’re offering customers. In WordPress, we call this Five for the Future, but it doesn’t have to be five percent; it could be 0.1%. Plan for it when modeling your expected IRR hurdle from an investment. Then, a few years down the line, when the small percentages start to add up, you won’t face a big catch-up or gap.

This underinvestment is itself an externality. It doesn’t appear on the balance sheet, but it can manifest in black swan events, such as security breaches or remote code exploits. Technical debt is one of the largest unaccounted-for externalities in the world today. Engineering, in the long run, is primarily a craft of maintenance rather than creation. The bulk of the cost of something comes from its upkeep over time.

Notes: Between the Stylesheets

Here is a collection of some notes I took at the Between the Stylesheets panel, complete with linky goodness. Update: Tantek’s post.

Jeffrey: The thing about CSS, it’s hard to understand unless you first think about markup. It’s hard to rethink the way you approach X/HTML. There’s so much to do that it seems strange to think about HTML, but in fact it’s important. We now have the chance to party like it’s 1993, we have the chance to write it like it was meant. We (designers) could do that until browsers became compliant. Saves Bandwidth. Work is now more accessible. Continue reading Notes: Between the Stylesheets

I Won!

I’m cleaning up my room, as I always do when the weather starts to get cold, and going through a drawer I found the most remarkable piece of paper. Apparently I had made a bet with my friend Lucas that George W. Bush was going to run for President. For posterity, here’s the entire text of the letter:

On 11-20-98 [we weren’t Y2K compatible] in World Geography with Mista [sic] Molloy, Lucas and Matthew made a $2 bet that George Bush Jr. will run for president.

[signature] Matthew Mullenweg | [signature] Lucas Spath

Matthew says he will
Lucas says he won’t

The person who is right gets the two dollars ($2)

We must have been quite bored to make the language that specific, but I guess next time I see Lucas I should hit him up for the money. I need to make more bets . . .

It’s Over

An address that has never been on the web in text or javascript form has begun receiving large amounts of spam, starting a few days ago. This is not a dictionary attack, it is specifically targetted toward this single address. The address is not guessable or a dictionary word. Luckily the address is disposable.

The only form this address has ever been online is in a PNG screenshot I posted about a year ago.

Open Source Business Conference

So there is an Open Source Business Conference happening in a few weeks a few blocks away from me and I just randomly came across the site. After SxSW, reading about OSBC is like being in another world: it’s $1500 to go, only two days long, the language on the site is sickeningly corporate, and I haven’t heard of a single person there. Then again, this is an “open source” conference with Microsoft as a platinum sponsor. A real Open Source conference would have no fees, everything would be web streamed, the line between speakers and attendees would be thin or non-existant, and the topics would not focus so much on money. Actually, it would be a bit like Bloggercon.