Brandon Rosage

I create websites and media, united with Ushahidi.

Jan 4, 2012

Deliver content-first HTML without sacrificing a navigation-first layout

One of the best design patterns, in my opinion, to come from the past four years of user interface design on mobile devices is the shift toward displaying content first and navigation second. Having so much less screen real estate than on the desktop has been fantastic for interfaces designed for reading and consuming; though it’s brought tremendous focus to utility apps, too.

But if it’s important in the design of your web product to build a responsive website that doesn’t rely on alternative URLs or subdomains to serve up an entirely new interface, it can be challenging to offer intuitive navigation to desktop users (where it’s displayed at the top of the page) while pushing that navigation to the bottom of the screen for small-screen users.

The brilliant speakers at this summer’s An Event Apart tour, like Luke Wroblewski, Jeremy Keith, Jeffrey Zeldman and Eric Meyer, synthesized some terrific approaches to this problem using nothing but CSS. No browser sniffing, no server-side code.

Smart semantic HTML is, again, rewarded.

There are a few approaches with CSS that address the need to re-order sibling elements. As I tackled this issue in Ushahidi’s SwiftRiver and Crowdmap user interfaces, I begrudgingly settled on the more bulletproof CSS 2.1 solution, ignoring a more elegant CSS3-only solution.

CSS3’s smart solution

Let’s assume I have two primary elements in my document’s body: Content and navigation. My HTML might look like this:

<body>
<div class="content">
<p>My content.</p>
</div>
<nav>
<ul>
<li>Navigation item 1</li>
<li>Navigation item 1</li>
</ul>
</nav>
</body>

By writing our markup first for small-screen devices, we don’t need to do anything out of the ordinary with our CSS here. Content will display first and our navigation will be available after that.

But for larger screens, where we want navigation to appear first, we could target the larger viewport with a CSS media query and insert the following CSS3 properties to reverse their display order:

@media screen and (min-width: 615px) {
    body {
        display: box;
        box-orient: vertical;
        box-direction: reverse;
    }
}

An old school, better-supported solution

The method I used on the control panels for Ushahidi Core and Crowdmap isn’t as intuitive as CSS3’s “box-” properties. But more browsers support it.

Assume the same HTML markup and media query, but leverage different display values and the caption-side property:

@media screen and (min-width: 615px) {
    body {
        display: table;
        caption-side: top;
    }
    nav {
        display: table-caption;
    }
}

The problem this solved on Crowdmap and Ushahidi Core was the need to:

  • Write HTML markup that listed a report’s full story and comments before its metadata (e.g. date, categories).
  • Display a report’s metadata before its full story and comments on large screens.

Crowdmap’s control panel displaying a report’s full story and comments first on a small-screen device

Crowdmap report on iPhone

Crowdmap’s control panel displaying a report’s metadata before its full story and comments on a large-screen device

Crowdmap report on desktop

Jeremy Keith put together a great write-up on these methods, as well as some use cases for leveraging the same CSS properties to display the elements horizontally.

So simple. So powerful.

Jan 4, 2012 |

A plea for progressive enhancement

Stephanie Rieger wrote a fantastic walk-through of the Barack Obama campaign website’s failure to function or display effectively on multiple devices — another example of designing and developing for the most capable browsers first, and nearly last.

She also explains how she approached a similar challenge using progressive enhancement to build a bulletproof product.

More like this, please.

Jan 3, 2012 |

Brilliance should lead to humility

Regarding my piece yesterday about a lack of modesty in the developer community, a family member responded with a much more suitable term: Humility.

He points me to a fantastic piece by Derek Ouellette in which he describes the danger of getting wound up by your brilliance in a specific area:

To summarize this, Dickson writes:

“True experts ought to be more conscious of their limitations than most. Knowing a lot in one area should, in theory, underline just how much there is to know outside of your specialty.”

Experts should know this more than the rest of us because they are experts. But the lesson is one we should all remind ourselves of regularly. Next time we get into a discussion with someone about something we believe in contention to something they believe, remember that what we know about that subject (even if we are experts in it) is far out weighted by what we don’t know.

I know I jab my fist in the air nearly every time I solve some complex scripting problem and declare, “I am a genius!” Sure, I’m joking. But I’m also guilty of later thinking that whatever smarts I used to solve that problem would be good for everyone.

They’re not. What I’m good at isn’t “the new literacy.”

Jan 2, 2012

Learn to code, but don’t get a big head about it

Like iOS and Mac developer Guy English, I’ve noticed a growing sentiment in the web development community that “writing code” or “programming” is somehow approaching a level of importance similar to writing a novel, essay or research paper.

WordPress founder Matt Mullenweg, for example, is fond of saying, “scripting is the new literacy.”

Unlike Guy English, I’d like to echo his response to this sentiment with a “me too.”

There’s a dusting of ego in the air, I think, when developers are suggesting that the near future will demand that most everyone know how to “write code,” just as they need to write English.

Guy English:

Writing software is a craft. I’m quite good at it. Brent and Jalkut are also very successful at our craft. But it’s a craft. It’s something we’re really good at but, in my opinion, it’s not something that everyone needs to care about.

Without a doubt, improving our world’s infrastructure through scripting will be one of the most important efforts of our lifetime. Designers, developers — people that write code — are, and will continue to be, in enormous demand. Their scripting literacy will be, in many ways, as valuable to them as their English, Spanish or German literacy.

But elevating that value to the level of general literacy (something we expect of everybody), rather than recognizing its place in our industry, is a mistake. I’d hate to see our community be disregarded as behaving too self-important.

UPDATE: I wrote a follow up to this piece regarding “humility,” a much more applicable term for this matter.