Comments
Patrick Collands wrote: collands (AT) gmail com I'd be very grateful for an invitation. Thank you.
Cloud Expo on Google News

SYS-CON.TV

2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Click For 2008 West
Event Webcasts
Media Types and Their Uses in CSS 2
There are presently 10 recognized media types in CSS

These days, not all users will be viewing your web site on a computer screen. Using Media types can open up a whole host of opportunities for restyling your content to cater to a variety of different devices. Media types can also open up a couple of cans of worms if you're still supporting archaic browsers, but we'll talk about that in a bit.

If you've begun to use Cascading Style Sheets for styling your screen documents, you've seen how powerful CSS really is. You may have even ventured into the realm of creating a print style sheet to facilitate a user's ability to print your web pages. If so, you already know that you had to specify the target medium (print) using the media attribute on the element. Or maybe you just copied something a friend told you to use and you really have no idea what you did. Likely the element in the head of your document looked something like this:

<link rel="stylesheet" type="text/css" media="print" href="print.css">

Tip: If you have not yet created a print style sheet, see Adrian Senior and Stephanie Sullivan's article in Macromedia's DevNet Center for a behind-the-scenes look at the creation of the Community MX print style sheet (www.macromedia.com/devnet/mx/dreamweaver/articles/screen_to_print.html)'

Recognized Media Types
There are presently 10 recognized media types in CSS 2; all, aural, braille, embossed, handheld, print, projection, screen, tty, and tv. CSS 2.1, which is now a Candidate W3C Recommendation, switches speech for aural in this list. These media types allow you to indicate to specific user devices, different methods of styling and presenting your content. As the list of possible devices grows, it is likely that more will be added. The names chosen for these media types are not case sensitive and should be fairly self-explanatory, but in case they're confusing, Table 1 is the list according to the W3C site:

Due to the variety of unique characteristics each media has, each media type may have certain properties that are unique to it. Some examples are:

  • page-break-before - applies only to paged media
  • pause-before - applies only to spoken media
These unique properties allow you more control within each media itself.

Media Type Tips to Keep in Mind
First, it is imperative to know which browsers and devices you are supporting. Take a look at your client's current browser statistics, or request detailed information regarding their desired browser and device support. This information determines the method you choose to specify your media-dependent style sheets.

Browser support for some of the media types can be tough. Netscape 4 doesn't support anything but screen, and even that may be buggy. Luckily though, the other media types won't choke it. IE4 can read all, screen, and print, so if that browser must be supported, you can't use the same tricks you use for NN4. Personally, I'm doing less and less for those old gals. I want them to receive the same information in a neat logical order, but outside that, unless a client's stats show me otherwise, the styling they see will be minimal.

My main goal for legacy browsers is to make sure they don't choke on the web pages. For more on CSS support in old browsers, RichInStyle.com has a CSS support chart (www.richinstyle.com/bugs/table.html) with information on browser support for the screen, all and print media types, among other CSS properties. The chart doesn't include any version-6+ browsers, but is good for keeping track of elderly browser support.

All
According to the CSS2 recommendation, if a media type is not specified, it should default to the all media type. Most browsers follow this guidance. The all media type can be used for properties that are available to all media devices. This sheet will start the CSS cascade, and from there, the specific devices, if in compliance, will continue by parsing their specific style sheet. You should note however, that older versions of Opera used media screen as their default display.

Screen
Screen is the most commonly used media type. At this time, the majority of assistive technology products available read the screen style sheets instead of aural ones. I hope that they'll catch up sooner rather than later. Remember though, that style sheets given the screen media type will not be used for any of the other devices, including printers.

Handheld
If you're creating a CSS document for handheld media, remember that you're creating not only for a small screen, but likely also a monochromatic one, with very little bandwidth or memory available. Sometimes the connection may be less than optimal as well. Be sure to use the {display:none} property to remove any extraneous page information to keep the display simple. Give them, "just the facts!" Here are some tips from the AcIS Handheld Report:

  • Use very few, low-resolution, or low color depth images
  • Use alt text for all images
  • Keep individual pages short
  • Use very little text formatting
  • Keep page formatting flexible to fit many screen shapes and sizes
For more tips, see Optimizing Web Pages for Handheld Devices at the Palm Power web site (www.palmpower.com/issuesprint/issue199902/avantgotips.html). Also be aware that Opera currently supports several media types including handheld.

Projection
This one is pretty nifty in my opinion. I first saw it in action at the fifth TODCON web conference event a couple years ago during Eric Meyer's presentation and later used it in my own. Opera still uses this media type to the best advantage. You can create a presentation for viewing either full screen or on an overhead projector.

This page on OperaShow (www.opera.com/support/tutorials/operashow/index.dml) gives you full instructions, but in a nutshell, you create your presentation as one long HTML document and then create the page breaks. This could even be used for an existing web site where the screen display looks completely different from the one needed or wanted for the projection device. There are some interesting styling possibilities that are available with this method. For example, you can place a watermark-type background image that will appear on each projected page. Simply set the image positioning value to fixed image in the body element in your CSS document. Or, you can give an interesting bordered heading style to the <h1> element that will be at the top of each page. In action, this one looks like magic - or even PowerPoint!

About Stephanie Sullivan
Stephanie Sullivan is a Web developer, partner at CommunityMX (www.communitymx.com), owner of VioletSky Design (www.violetsky.net), and contributing author of Dreamweaver MX 2004 Magic.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Media Types and Their Uses in CSS. These days, not all users will be viewing your web site on a computer screen. Using Media types can open up a whole host of opportunities for restyling your content to cater to a variety of different devices. Media types can also open up a couple of cans of worms if you're still supporting archaic browsers, but we'll talk about that in a bit.


Your Feedback
MXDJ News Desk wrote: Media Types and Their Uses in CSS. These days, not all users will be viewing your web site on a computer screen. Using Media types can open up a whole host of opportunities for restyling your content to cater to a variety of different devices. Media types can also open up a couple of cans of worms if you're still supporting archaic browsers, but we'll talk about that in a bit.
Latest Cloud Developer Stories
The Enterprise Cloud Requires a real time infrastructure and a management discipline that understands and can enforce service level discipline.
CloudBench Applications, Inc. announced its financial results for the three months and nine months ending September 30, 2009. All amounts are stated in Canadian dollars unless otherwise noted. Revenues from BasicGov, the Company's cloud computing solution for local government, gr...
The new contract is an industry first, with CSC being the first Microsoft partner to lead and win a cloud computing services agreement of this scale. Under terms of the contract, CSC will provide Royal Mail Group's 30,000 employees with access to new IT services using Microsoft's...
Operates in over 170 countries and is one of the world’s leading providers of communications solutions and services. Richard Tarboton talks for MeettheBoss.TV on his role as Head of Energy & Carbon for BT and what they are doing towards reducing carbon emissions.
CA is going to put its Agile Planner software on salesforce.com’s Force.com platform in the first half to accelerate development time and give users visibility over their development initiatives to reduce time-to-market. Customers are supposed to be able to accelerate the deploym...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers
ADS BY GOOGLE

Breaking Cloud Computing News
CloudBench Applications, Inc. announced its financial results for the three months and nine months e...