473,322 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

When are alternate stylesheets invoked?

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

Mar 16 '07 #1
9 2480
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
Mar 16 '07 #2

Andreas Prilop wrote:
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

Mar 16 '07 #3
On Fri, 16 Mar 2007, johkar wrote:
>"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
Mar 16 '07 #4
johkar wrote:
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?
Mar 19 '07 #5
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
Mar 19 '07 #6
"Bergamot" <be******@visi.comwrote in message news:56*************@mid.individual.net...
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
Mar 21 '07 #7
On Mar 19, 8:22 am, Bergamot <berga...@visi.comwrote:
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.

Mar 29 '07 #8
On Thu, 28 Mar 2007, johkar wrote:
I realize you can
use media=print, but some usability gurus poo poo this idea...
References?
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
and what is the browser support for it?
Internet Explorer 6 fails - real browsers support alternative
stylesheets.
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
Mar 29 '07 #9
johkar wrote:
On Mar 19, 8:22 am, Bergamot <berga...@visi.comwrote:
>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? :)
but some usability gurus poo poo this idea...
This is the first I've heard that opinion. I use print stylesheets all
the time.
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
Mar 29 '07 #10

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

Similar topics

3
by: Mike Agnes | last post by:
I would like to link to a single XHTML file and at the same time specify which of several alternative stylesheets should be used for screen presentation. Is this possible with the current...
72
by: Herbert | last post by:
I'm still relativey new to stylesheets, so I'm hoping that the way I'm going about things can be seriously improved upon, i.e . I just haven't undersood something obvious about the 'cascading'...
13
by: Toby A Inkster | last post by:
www.authoring.stylesheets] For ages I have provided links to alternate stylesheets from my pages as per W3C recommendations: <link rel="stylesheet" href="baz" type="text/css" title="Baz"...
21
by: Steel | last post by:
Hi at all, I have a very long html page with many photo. Therefore the best to print this page is to print the some page as PDF. Therefore I maked a PDF file like my page to print best. I'ld want...
5
by: User | last post by:
If I want to provide alternate stylesheets (eg red.css, green.css), is it better to put all the stuff that is common to both sheets in a separate css file (eg basic.css) and use @import at the top...
4
by: Charles Jamieson | last post by:
I declare a class class myClass{ public: ~myClass();
17
by: highli | last post by:
When a non-default constructor provided in a class, the default constructor is not available anymore. In what cases shall a default constructor be defined explicitly? Specifically, in the...
3
by: Tony Johansson | last post by:
Hello! When you allocate object dynamically which mean on the heap I find that a problem when using exception. What is the prefer method to handle this kind of problem. //Tony
4
by: leegold | last post by:
I use "core" styles from w3. But at the time of this email time W3 is down ie. i cannot connect via browser to w3.org and any web page the uses the core styles will freeze/hang. Is there a way...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.