Designing for Context with CSS

Web standards promised us improved multimedia delivery: the ability to optimize content for computer screens, handhelds, printers, projection devices, and other media.

Article Continues Below

The CSS required to accomplish this is simple. All you have to do is import a separate style sheet for each media type to override the style selectors for the primary medium. Check out Eric A. Meyer’s fantastic and influential article “Going to Print” for an in-depth example of how to do this. (Warning: some media aren’t fully supported.)

Most of the discussion thus far in the design community has focused on styling content for varying media. Specifically, designers have tried to improve the accessibility of content, stripping away heavy graphics for handhelds or switching to more legible fonts for print.

We don’t have to stop there. Instead of using CSS to style the same content for different media, why not use it to display content especially suited for the situation?

Imagine that a designer reads an article in his favorite web magazine and then prints it out. The designer staples the pages together, grabs a highlighter, and reads the article, marking the most important points and jotting down notes in the margins. Over time, he refers back to the hardcopy.

What can we say about this situation?  Is there anything unique about it?  What makes it worth noting?

Different media offer different opportunities#section2

First of all, the designer in the above example viewed the article in a different medium than it was originally designed for, and used the article in ways that it couldn’t be used online (i.e. highlighting selected passages). Secondly, we know the designer cared about the article so much that he wanted a physical copy of it. That makes him fairly special compared to the folks who “only” read the web version.

Designing for context#section3

Say you want to use context-aware content to speak to potential visitors to your site. What happens when someone who hasn’t visited your site reads a printout of one of your articles? What message can you give that person when they print the article that you wouldn’t give to someone who reads it online? If your goal is to increase readership, you might say something like:

You are viewing a printed version of an article that came from a fantastic website (http://www.xyz.com) where you can find many more relevant, insightful articles. We think that you’ll be interested in this other article (http://xyz.com/article02.html) because it deals with the same subject as the one you are now reading.”

If your goal is to increase account sign-ups, you might say something like:

If a friend or colleague gave you this printout, you might be eligible for a special, one-time offer.  Sign up for an account and we’ll give you 10% off your first purchase.”

If your goal is to get people inquiring about your services, you might say something like:

You are reading an article written by J.D. of XYZ Company.  J.D. lives this stuff. If you have any questions about the services mentioned in the article simply give J.D. a call at her personal number (321-867-5309 ext 123) and she’ll be able to talk with you in-depth about what XYZ can do for you”.

(The third example might not be particularly suited to print, but might work well for readers who view your content on a handheld phone. You know it’s not hard for them to call you.)

But don’t just put these messages on the website for everyone to see. You don’t want to deliver them out of context; you want to create the special situation that exists when you talk to people in their context and they realize it.

A dash of CSS will do#section4

The CSS used to accomplish this is very easy. Create a div with the content that is specifically suited for the medium you’re designing for — for this example, let’s say print:

<div id=“offer4print”>
  <p>Highly persuasive text of offer.</p>
</div>

Use the display: none; property applied to the div for your screen style sheet so that the div does not display on the web (screen). In your style sheet for screen, use:

div#offer4print { display: none; }

Then style the declaration in your print (or whatever media you’re designing for) however you’d like in your style sheet for print:

div#offer4print { /*insert styling for print here*/ }

Other ideas for printing:#section5

  • If you know a reader’s name (because, for instance, they’re logged in), insert their name on the printed version. Now it’s a print piece designed especially for them: ex libris Joshua Porter.
  • Give them special offers. Remember, these people are different from casual readers; treat them accordingly and design for their context.

Ideas for handhelds:#section6

  • Phone numbers (obviously). Offer direct access to information related to the article they printed. They will appreciate it.
  • Provide them with a simple way to email themselves an easy-to-read (and easy to print) PDF version of the document.

Start doing stuff like this, and people will talk about you. They’ll show their friends and coworkers. They might say, “Hey look at this. This only showed up after I printed it. That’s different.  Show this to the website VP. I’m going to see if any of the other pages on the site do this.”

Exploring these methods, you can come up with unique innovations that work particularly well for your users. Of course, you don’t need CSS to do this. You can use any technology with the ability to distinguish between media. The easiest way, however, takes a little context and just a dash of CSS.

Related articles:#section7

52 Reader Comments

  1. “there are little things like browser title bar text; can that be styled too?”
    – Philip Jones

    The browser title is tag content, so until most browsers support the CSS3 content selector.. no, not really.

    TECHNICALLY of cource it is possible, but then we hit browser limitations, as ever.

    If you have the time you *could* put the CSS in there – forward compatibility if you like. It won’t do any harm, and means no more edits when its actually supported.

    Depends on how inportant it is to you I guess.

  2. I think in principle this is a good idea for providing context dependent messages. However how would this strategy fair with search engines . Won’t they see the text? It wouldn’t be very helpful if the search engine picked up the text only for a user to visit the page and see that seemingly it wasn’t there. It sparks visons of text the same colour as the page background. Please correct me if I’m wrong, it’s just a concern I had.

Got something to say?

We have turned off comments, but you can see what folks had to say before we did so.

More from ALA

I am a creative.

A List Apart founder and web design OG Zeldman ponders the moments of inspiration, the hours of plodding, and the ultimate mystery at the heart of a creative career.
Career