Re: WCAG2 Conformance Questions

Try the following code:

Save this code as file.html (Save in UTF-8):

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en">
<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <meta content="english" name="language" />
    <meta http-equiv="content-language" content="en" />
    <link rel="stylesheet" href="/print.css" type="text/css" media="print" />
    <link rel="stylesheet" href="/screen.css" type="text/css" media="screen" />
    <!--
    Above "screen.css" is just to show that the same can be done for
media="screen"
    No code included for screen.css in example
    -->
    <title>
        Separate stylesheets for screen and printer
    </title>
</head>
<body>
<h1>Separate stylesheets for screen and printer</h1>
<div class="noprint">This text should not be printed, due to the class
noprint being set to not display on printer. As David said,
this is often where menu systems and such are placed.
</div>
<div>This text, on the other hand, should print, as it has no declaration
of behavior. This is also the case with the above header.
</div>
</body>
</html>

Save the following as print.css:

.noprint
{
display: none;
}

This should render a result where all of the content in file.html will be
shown on screen, but only the header and the second div should be printed.
The code has been tested on Linux Ubuntu, Firefox 3 and on Microsoft
Windows, Firefox 3, Internet Explorer 6, Internet Explorer 7. Like David
says, it should work in most browsers.

Best regards,

Joachim Andersson

2008/8/25 David Woolley <forums@david-woolley.me.uk>

>
> Ryan Jean wrote:
>
>> It didn't work.
>>
>
> Unless you have a higher priority rule that sets some other display value,
> it certainly should work on any reasonably modern browser - in fact, the
> failure mode on older browsers, would be to suppress that text  not just in
> the printout.
>
> Generally you will find that print media types are honoured on both
> actually printing and print previewing.
>
> However, from a semantics point of view, it would be better to use
> something like:
>
> <div class=".... navigation ....."...
>
> and use a "." selector, e.g.
>
> .navigation, .banneradvert {display: none}
>
> or whatever other reason applies for the content being noise.
>
>> Flint, MI
>>
>>
>> -----Original Message-----
>> From: David Woolley [mailto:forums@david-woolley.me.uk] Sent: Monday,
>> August 25, 2008 11:14 AM
>> To: Ryan Jean
>> Cc: w3c-wai-ig@w3.org
>> Subject: Re: WCAG2 Conformance Questions
>>
>> Ryan Jean wrote:
>>
>>>
>>> What does the media="print" do?
>>>
>>>
>> Assuming the syntax is good, it causes the enclosed style rules only to
>> apply when printed.  Typically you code all your navigation stuff as
>> display:none.
>>
>>
>
> --
> David Woolley
> Emails are not formal business letters, whatever businesses may want.
> RFC1855 says there should be an address here, but, in a world of spam,
> that is no longer good advice, as archive address hiding may not work.
>
>

Received on Tuesday, 26 August 2008 12:06:36 UTC