473,537 Members | 2,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CSS for various media: practical questions

For a long time, I've used CSS to style my webpages, but only for
media "screen" and "print". Now I've started looking into styling them
for other media like "projection" and "handheld". I'd be happy to hear
your advice on a couple of practicalities.

1. media="all" required?

In the <head> of my pages, I have the following:
<link rel="stylesheet" href="style.css" type="text/css"></link>

And in style.css, I have a couple @media rules like this:
@media print { /* Don't print certain images, good page breaks, etc.
*/ }
@media projection { /* Use sans-serif font for body text, etc. */ }

Most browsers use the @media print rules in my style.css when printing
the page.But now I found out that according to the specs, the value of
the media attribute should default to screen if not specified, so
strictly speaking, my style.css should not be applied when printing
the page.

I will of course add media="all" on all of my pages, but I'd like to
hear how various browsers behave in this respect.

2. Splitting CSS or keeping it together?

I'm also wondering what would be most efficient: keeping all CSS
together, or creating various files: all.css, print.css,
projection.css, etc.?

Most visitors just view the pages with a normal web browser on a
normal PC screen. They don't really need the "handheld" or "braille"
part of the CSS. On the other hand, they may decide to print the page,
or to have it read to them. And then it would be useful to have the
relevant "print" or "aural" parts already available, instead of having
to go back to the server to ask for it. I'd guess that the few extra
bytes needed for these bits of CSS aren't much of a problem for the
average visitor, so I'd rather keep all CSS together in one file. What
are your opinions on this?

3. Handheld CSS?

An exception may be made for handheld devices, which typically have
low bandwidth and small memory. Getting all those CSS parts they don't
need is really a waste, so I had better make a separate file for these
devices. Would you agree?

I test the "handheld" styles using Opera's small-screen mode
(Shift-F11). I noticed that even if I put media="all" in the <link> to
my stylesheet, Opera doesn't apply the "handheld" part when rendering
in small-screen mode. It does use my styles if I explicitly mention
media="all,handheld". It seems that this is in disagreement with the
specs, but it does make some sense. What do other handheld devices do
when they see a media="all" attribute?

4. Testing aural and other style sheets?

The last thing I'd be glad to learn more about, is ways to test my CSS
for several media. It's easy enough to print a page, and Opera lets me
test projection (in full-screen mode) and handheld (in small-screen
mode) with one keystroke. I'm still looking for good,
standards-compliant, and preferably free tools that let me test my
aural, braille, embossed, or other styles.

That's a lot of questions, I hope I'll get some answers (remarks,
suggestions, ...). Thanks!

Garmt de Vries.
Jul 21 '05 #1
1 2932
Garmt de Vries wrote:
For a long time, I've used CSS to style my webpages, but only for
media "screen" and "print". Now I've started looking into styling
them for other media like "projection" and "handheld". I'd be happy
to hear your advice on a couple of practicalities.
There are not many practical applications for this, I'm afraid. For
example, WebTV ignores media="tv". Even media="print" has only limited
support, e.g., for pagination.
1. media="all" required?
Required for what? (Was this intended as a heading of some sort?)
In the <head> of my pages, I have the following: <link
rel="stylesheet" href="style.css" type="text/css"></link>
<link> is an empty element in HTML. Are you using XHTML? If so, why?
in style.css, I have a couple @media rules like this: @media print {
/* Don't print certain images, good page breaks, etc. */ } @media
projection { /* Use sans-serif font for body text, etc. */ }
Use with care! The entire blocks enclosed in these media rules will be
ignored by IE 5.x/Mac.
Most browsers use the @media print rules in my style.css when
printing the page.But now I found out that according to the specs,
the value of the media attribute should default to screen if not
specified, so strictly speaking, my style.css should not be applied
when printing the page.

I will of course add media="all" on all of my pages, but I'd like to
hear how various browsers behave in this respect.
I prefer designing a separate print stylesheet, but to each his own.
2. Splitting CSS or keeping it together?

I'm also wondering what would be most efficient: keeping all CSS
together, or creating various files: all.css, print.css,
projection.css, etc.?
In principle, a ua should only download stylesheets that it can use.
Thus, a graphical browser should ignore a stylesheet where the <link>
media attribute is set to aural or handheld, while an aural browser
should ignore screen, tv, or projection. Maybe someday that will
actually be the case. So keep them separate, so that users will not need
to download stylesheets they don't need.
Most visitors just view the pages with a normal web browser on a
normal PC screen. They don't really need the "handheld" or "braille"
part of the CSS. On the other hand, they may decide to print the
page, or to have it read to them. And then it would be useful to have
the relevant "print" or "aural" parts already available, instead of
having to go back to the server to ask for it.
A ua should retrieve the stylesheets it needs; this means a graphical
browser that has a print function should download screen and print
stylesheets. My suggestion: be honest in your stylesheet media
attributes, and let the browsers sort it out, unless you know of buggy
behavior that you wish to work around.
3. Handheld CSS?
Precious little support for that at present, I'm afraid. Even the W3C
CSS "validator" doesn't support media="handheld"!
4. Testing aural and other style sheets?


Until ua development catches up, it will be hard to conduct tests in
other than graphical browsers.

--
Brian (remove "invalid" to email me)
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
10319
by: Lonewolf | last post by:
Hi everyone, pls forgive me for my lack of knowledge and skills if my question sounds very stupid. I am trying to implement a video conferencing software and I am currently looking at a few set of technologies, among them WMP, RealMedia, H.323 and XviD (not sure if it is suitable for streaming even) . I would like to seek the advice of those...
6
1748
by: Mustafa Rabie | last post by:
Hi All, I have a customer, who wants me to add online radio to his web site. 1) How can i add the media player object to the site 2) How can i dynamically change the url when i user clicks on a link to another radio station? thanks a lot for your help appreciated Mustafa Rabie
0
836
by: Chris Johnson | last post by:
Hi guys, I know this is ASP but its VB driven, so I hope its cool to ask here. Im trying to follow the exmaple for a web display media library given here: http://msdn.microsoft.com/coding4fun/webcoder/musiclib/default.aspx But, Im having difficulties. His code seems both imcomplete and not entirely documented. Im working right now on...
19
19230
by: Tony | last post by:
I'm working on project that plays movies using Windows Media Player and I'm controlling everything with JavaScript. Per the client I only need to support IE 6 or greater which happens to make things a bit easier. What I need to do is create a playlist and play it using JavaScript. I keep on getting close but not close enough to play the dang...
37
9479
by: cman | last post by:
Could you point me to the practical uses of XOR in assembly and algorithms? I understand XOR to be "true if and only if p is true or q is true". Where is this used? I draw a blank on usage. Tilak
12
1830
by: =?Utf-8?B?Q2Fubm9kYWwxOQ==?= | last post by:
I'm having a problem getting the accurate information to the guide.. Its saying its soposted to be this one show, and its somthing else.. I've double check my setting for what general area, and I have the right one.. Can't figure it out,, I have another program from Hauppauge products, and that version works and downloads the correct...
5
2621
by: Fred Chateau | last post by:
I am currently using an Object element of type "application/x-mplayer2" to create a media player in ASP.NET 3.5, and was wondering if there is a better way to instantiate WMP in a browser. I'm hoping to find something with better cross-browser compatibility. I looked at System.Windows.Media.MediaPlayer in PresentationCore.dll but I'm...
1
1880
by: Aandrew | last post by:
Im writing an application in C# which will be used to play media via the windows media control from a playlist. I have been able to play media through the control and use the PlayStateChange event to detect when the media has finished. All well and good. What Id like to do however is encapsulate this functionality so that I pass a media...
3
1714
by: Robert Dunlop | last post by:
I am using Microsoft Visual Studio 2005 for development of an ASP.NET site, and I have a problem that greatly effects my workflow at times. It seems that after I upload new files anywhere within the directory structure of the site that is visible to VS, the next time I perform a build VS takes extra time, apparently downloading the new files...
0
7365
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7301
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7688
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7281
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7644
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5827
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3353
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3345
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.