HighDots Forums  

When are alternate stylesheets invoked?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss When are alternate stylesheets invoked? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
johkar
 
Posts: n/a

Default When are alternate stylesheets invoked? - 03-16-2007 , 11:47 AM






I need some browser implementation clarification.

In the below example, the alternate stylesheet could be invoked by
user agents that support alternate stylesheets or by script. Are
there any browsers that don't recognize "alternate stylesheet" as a
value of the rel attribute and just implement it automatically thus
overriding sheet2.css? Just need to know what I need to worry about.

<link href="sheet1.css" rel="stylesheet" type="text/css"
id="default1" />
<link href="sheet2" rel="stylesheet" type="text/css" id="default2"
title="Default" />
<link href="sheet3.css" rel="alternate stylesheet" type="text/css"
id="print" title="Print" />

Thanks


Reply With Quote
  #2  
Old   
Andreas Prilop
 
Posts: n/a

Default Re: When are alternate stylesheets invoked? - 03-16-2007 , 11:52 AM






On Fri, 16 Mar 2007, johkar wrote:

Quote:
In the below example,
Make a sample page and post the URL here!

Quote:
Are
there any browsers that don't recognize "alternate stylesheet" as a
value of the rel attribute
Internet Explorer 6.

Quote:
link href="sheet3.css" rel="alternate stylesheet" type="text/css"
id="print" title="Print" /
"alternate stylesheet" specifically for print is nonsense.
And, btw, the slash before the final > is also nonsense.

--
In memoriam Alan J. Flavell
http://groups.google.com/groups/sear...Alan.J.Flavell


Reply With Quote
  #3  
Old   
johkar
 
Posts: n/a

Default Re: When are alternate stylesheets invoked? - 03-16-2007 , 12:09 PM




Andreas Prilop wrote:
Quote:
On Fri, 16 Mar 2007, johkar wrote:

In the below example,

Make a sample page and post the URL here!

Are
there any browsers that don't recognize "alternate stylesheet" as a
value of the rel attribute

Internet Explorer 6.

link href="sheet3.css" rel="alternate stylesheet" type="text/css"
id="print" title="Print" /

"alternate stylesheet" specifically for print is nonsense.
And, btw, the slash before the final > is also nonsense.

--
In memoriam Alan J. Flavell
http://groups.google.com/groups/sear...Alan.J.Flavell
Could you please expand on your answer regarding it being nonsense for
"alternate stylesheet" being used for print? I am totally open to
best practices, but there doesn't seem to be consensus on how best to
implement printable pages. Some camps of experts appear to dislike
using print media...probably more for usability reasons. Enlighten
me.

Thanks



Reply With Quote
  #4  
Old   
Andreas Prilop
 
Posts: n/a

Default Re: When are alternate stylesheets invoked? - 03-16-2007 , 12:24 PM



On Fri, 16 Mar 2007, johkar wrote:

Quote:
"alternate stylesheet" specifically for print is nonsense.

Could you please expand on your answer regarding it being nonsense for
"alternate stylesheet" being used for print?
Just use
<link rel="StyleSheet" media="print" ......
for printing.
http://www.htmlhelp.com/reference/css/style-html.html

There's no need for "Alternate Stylesheet" here - unless you want
*two* different printing stylesheets.

--
In memoriam Alan J. Flavell
http://groups.google.com/groups/sear...Alan.J.Flavell


Reply With Quote
  #5  
Old   
Vid the Kid
 
Posts: n/a

Default Re: When are alternate stylesheets invoked? - 03-19-2007 , 03:59 AM



johkar wrote:
Quote:
I need some browser implementation clarification.

In the below example, the alternate stylesheet could be invoked by
user agents that support alternate stylesheets or by script. Are
there any browsers that don't recognize "alternate stylesheet" as a
value of the rel attribute and just implement it automatically thus
overriding sheet2.css? Just need to know what I need to worry about.

link href="sheet1.css" rel="stylesheet" type="text/css"
id="default1" /
link href="sheet2" rel="stylesheet" type="text/css" id="default2"
title="Default" /
link href="sheet3.css" rel="alternate stylesheet" type="text/css"
id="print" title="Print" /

Thanks

Alternate stylesheets can be invoked by scripts, yes, but they are
normally invoked directly by the user through some kind of browser
command. In the code you cited, sheet1.css and sheeet2 (assuming they
are served with the correct MIME type despite the second not having a
file extention) would actually be combined, according to CSS cascading
rules. Sheet3.css would be invoked by the user selecting the "Print"
alternate style from their browser menu.

If you want to have a print stylesheet invoked automatically when a
document is printed, use:
<link href="print.css" rel="stylesheet" type="text/css" id="print"
title="Print" media="print" />

The default value for the media attribute is "all", so any stylesheets
included with no media specified will also be used for printing. Again,
conflicts between stylesheets are resolved by CSS cascade rules.

--
David "Smith"
a.k.a. Vid the Kid

Does this font make me look fat?


Reply With Quote
  #6  
Old   
Bergamot
 
Posts: n/a

Default Re: When are alternate stylesheets invoked? - 03-19-2007 , 09:22 AM



Vid the Kid wrote:
Quote:
Alternate stylesheets can be invoked by scripts, yes, but they are
normally invoked directly by the user through some kind of browser
command.
I believe, however, that browsers tend to pre-load the alternate
stylesheets along with the default(s). Those rules just aren't applied
until requested. I mention this because there's been some question in
the past about when a browser actually retrieves an alternate stylesheet.

Quote:
link href="print.css" rel="stylesheet" type="text/css" id="print"
title="Print" media="print" /
I'm curious - what purpose does the id attribute serve here? I've never
used it on stylesheets before.

--
Berg


Reply With Quote
  #7  
Old   
-Lost
 
Posts: n/a

Default Re: When are alternate stylesheets invoked? - 03-21-2007 , 12:27 AM



"Bergamot" <bergamot (AT) visi (DOT) com> wrote

Quote:
Vid the Kid wrote:

Alternate stylesheets can be invoked by scripts, yes, but they are
normally invoked directly by the user through some kind of browser
command.

I believe, however, that browsers tend to pre-load the alternate
stylesheets along with the default(s). Those rules just aren't applied
until requested. I mention this because there's been some question in
the past about when a browser actually retrieves an alternate stylesheet.

link href="print.css" rel="stylesheet" type="text/css" id="print"
title="Print" media="print" /

I'm curious - what purpose does the id attribute serve here? I've never
used it on stylesheets before.
Outside of an accessing script, I believe there is no purpose.

http://www.w3.org/TR/html4/struct/links.html#h-12.3

Calls its use a "document-wide identifier." And:

http://www.w3.org/TR/html4/struct/gl...l#id-and-class

Refers to it as a style sheet selector, and a means to reference a particular element from
a script.

-Lost




Reply With Quote
  #8  
Old   
johkar
 
Posts: n/a

Default Re: When are alternate stylesheets invoked? - 03-28-2007 , 11:36 PM



On Mar 19, 8:22 am, Bergamot <berga... (AT) visi (DOT) com> wrote:
Quote:
Vid the Kid wrote:

Alternate stylesheets can be invoked by scripts, yes, but they are
normally invoked directly by the user through some kind of browser
command.

I believe, however, that browsers tend to pre-load the alternate
stylesheets along with the default(s). Those rules just aren't applied
until requested. I mention this because there's been some question in
the past about when a browser actually retrieves an alternate stylesheet.

link href="print.css" rel="stylesheet" type="text/css" id="print"
title="Print" media="print" /

I'm curious - what purpose does the id attribute serve here? I've never
used it on stylesheets before.

--
Berg
Sorry, I have been absent after my original post. I realize you can
use media=print, but some usability gurus poo poo this idea...there
seems to be two camps. One camp advocates using media=print and the
other wants to invoke stylesheet switching either using JavaScript or
the server to show the printable page to the user in a new window.

There can be much debate over which to do. One question which has not
really been addressed is when did "alternate stylesheet" become a
valid value for the rel attribute...and what is the browser support
for it? I realize that could be a question for the HTML newsgroup,
but there is some crossover.



Reply With Quote
  #9  
Old   
Andreas Prilop
 
Posts: n/a

Default Re: When are alternate stylesheets invoked? - 03-29-2007 , 09:29 AM



On Thu, 28 Mar 2007, johkar wrote:

Quote:
I realize you can
use media=print, but some usability gurus poo poo this idea...
References?

Quote:
One question which has not
really been addressed is when did "alternate stylesheet" become a
valid value for the rel attribute...
In CSS level 1, i.e. 1996.
http://www.htmlhelp.com/reference/cs....html#external

Quote:
and what is the browser support for it?
Internet Explorer 6 fails - real browsers support alternative
stylesheets.

Quote:
I realize that could be a question for the HTML newsgroup,
No, this is the right group.

--
In memoriam Alan J. Flavell
http://groups.google.com/groups/sear...Alan.J.Flavell


Reply With Quote
  #10  
Old   
Bergamot
 
Posts: n/a

Default Re: When are alternate stylesheets invoked? - 03-29-2007 , 02:53 PM



johkar wrote:
Quote:
On Mar 19, 8:22 am, Bergamot <berga... (AT) visi (DOT) com> wrote:
Vid the Kid wrote:

link href="print.css" rel="stylesheet" type="text/css" id="print"
title="Print" media="print" /

I'm curious - what purpose does the id attribute serve here?

I realize you can use media=print,
Am I reading your response wrong, or did you read my question wrong?

Quote:
but some usability gurus poo poo this idea...
This is the first I've heard that opinion. I use print stylesheets all
the time.

Quote:
One camp advocates using media=print and the
other wants to invoke stylesheet switching either using JavaScript or
the server to show the printable page to the user in a new window.
The latter is the way things were done before print stylesheets had any
real support. Why continue an outdated practice if you don't have to?
It's just more work, and I don't see any benefit to the user.

BTW, you don't need a separate stylesheet just for print. You can also
use @media rules within a common stylesheet. This is my preferred way of
setting print rules.

@media screen, projection {rules}
@media screen, projection, print {rules}
@media print {rules}

The navigation menu styling, background images and other screen-only
things are in the first group. General content formatting is usually in
the second group. The last group sets display:none on the navigation
menu and other things that shouldn't be printed and occasionally has
some extra styling just for print.

It works for me. YMMV

--
Berg


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.