Media specific styles

Media specific styles

by Miles Berry -
Number of replies: 2
Forgive me if this has been asked and answered already, but I'm only just getting into the whole css thing.

I've come across the notion of media-specific stlyes, and it occurs to me that it would be cool if Moodle could pick an appropriate style depending on the display device being used - a standard one for the screen, another if on a pda (or even a phone), perhaps another for printing, and even some clever text only type for screen readers and text based browsers.

However, as Moodle Themes aren't set up as simple stylesheets but are embedded in php code, I can't see where one could make the changes necessary to include appropriate @import or <link > tags. Any ideas folks?

If this can be made to work, then some time spent creating a simple, elegant printer style might be well spent.
Furthermore, if we're serious about Moodle on PDAs, then I suspect something may need to be done about the block code, as David Scotson has suggested for his Kublick theme and other two column themes.
Average of ratings: -
In reply to Miles Berry

Re: Media specific styles

by David Scotson -

For Kubrick I just used the old fashioned (pre 1.5 method) in header.html:

<link rel="stylesheet" type="text/css" media="print" href="<?php echo $theme ?>/print.css" />

I'm unaware of any other method that works with the Moodle styles.php system.

It's probably worth noting that 'handheld' stylesheets seem to be widely ignored. Handheld browsers seem to prefer using clever software to reformat 'normal' websites rather than accept specific handheld styles, and websites seem to prefer providing an entirely seperate webpage with substantially different content.

On the other hand 'printer' styles seem quite a good idea, and 'alternate' style sheets are useful for providing accessible, zoom and lightweight styles via user preferences so this kind of thing is quite important.

In reply to David Scotson

Re: Media specific styles

by Andrew Walker -
Does anything other than Opera support the handheld media type?

I've sometimes thought about creating specific handheld styles but I've avoided it so far - usually on the basis that the "clever software" such as SSR will probably do a better job of laying out the page than I will wink

As is mentioned in this post - http://my.opera.com/jax/journal/26 - what happens if the site has a handheld stylesheet but it is bad for the user?