Media types

In CSS, you can mark a block as applying only to certain types of media.  You can also import a stylesheet on the condition that you’re rendering to a particular kind of media.  CSS2 defines the available media types as braille, embossed, handheld, print, projection, screen, speech, tty, and tv.  HTML4 also defines aural, which is roughly equivalent to speech in CSS2.

Every CSS renderer, including Cowbell, must render to some media type.  We could render to screen, by which is generally meant “styling web pages on a desktop monitor”.  But window borders are rather different from web pages.  If we do render to screen, would it be useful to allow the distinction between screen and handheld (so if you’re viewing the window borders on an N900, the stylesheet can adapt?)  If we don’t, what should we render to?  There doesn’t seem to be provision or precedent for making up new media types such as window-borders.

If we do make up a new type, perhaps we should make up some media queries to go with it.  Would it be useful to write rules which depended on the width or DPI of the monitor?  To some extent, you can already depend on the DPI by using linear units such as mm instead of px, so on higher-resolution screens the borders don’t shrink away to nothing.  I’m not sure the ability to colour them differently, and so on, is very useful.

You might think that this is only of theoretical interest, since nobody would use a Cowbell stylesheet to style anything other than window borders.  But consider the use of SVG as background images; SVG may be styled by CSS, and it might make sense to refer back to the main stylesheet to do so.  Such styling would possibly have a different media type from the rendering of the window borders themselves.


  • Do we render to screen?
  • If so, do we make a distinction for handheld?
  • If not, what media type do we render to?
  • Is it worth supporting media queries?

Published by

Thomas Thurman

Mostly themes, triaging, and patch review.

2 thoughts on “Media types”

  1. Apple introduced media queries for the iPhone because so many sites were using “handheld” to create cut-down, minimalist websites and Apple wanted the iPhone to render rich, regular websites. A more charitable assessment might be that “screen” vs. “handheld” is a binary division, but it’s reasonable that theme creators might want to use different resources for an 320×480 handheld versus an 800×480 netbook versus a 30″ 1920×1080 desktop monitor, and maybe a few more divisions in-between. If GNOME is willing to redraw icons for 16×16 versus 20×20 versus 22×22 versus 24×24 versus 32×32, it seems reasonable for themes to be able to make similar distinctions.

    I’d suggest that cowbell not bother with media types terribly much – if the spec says compliant renderers have to support *some* media type, I guess ‘screen’ would be it. On the other hand, I expect media-queries would be very very useful – both for ‘how big is the monitor containing this window’ (note: not the total desktop size), and ‘how big is the window I’m rendering’ (if it’s very tall and narrow, maybe the title should be drawn on the left rather than the top, or not drawn at all)

  2. Have you ever seen a handheld device with a usable windowng? I mean do you imaging full blown gnome on Maemo? AFAIK, every handheld out there does its own window management in its own way and none of it ever did windows with borders. I’ve seen just full screen windows and widgets, which don’t have any window borders either.

    From the other hand some netbooks do use window borders. But I think it’d be easier to develop alternate version of theme for small screens rather than rely on theming engine capabilities.

    So I think it’s not worth spending time on handling any media type other than screen. And it’s not worth bothering supporting media queries.

Comments are closed.

Leave a Reply

Your email address will not be published. Required fields are marked *