By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

Persistent, default and alternate styles

P: n/a
I am trying to understand the differences between and uses of
persistent, default and alternate styles. I have read
http://www.w3.org/TR/REC-html40/present/styles.html section 14.3.2 on
specifying external style sheets in link using combinations of rel and
using or not using the title attribute.

I think I sort of understand rel="alternate stylesheet". It seems to be
able to act something like the media="print" or media="handheld" or
media="projection" Except it does not act automatically to produce the
layout as defined. Instead, the user agent has to support it, and the
user has to select the alternate style sheet. I can't find access in
Safari. In Firefox, Page Style. In Opera, View, Style, and then a list
of the Title given to each of the style sheets in the link to them.

However the reference above says to name the alternate style sheet using
the title attribute. Whereas at
http://www.w3.org/TR/2002/CR-css3-me...ries-20020708/ there are
examples of links to them without title attributes. So is it required
or not? I would think it is required. I think this is supported by the
use of title to indicate the difference between persistent and preferred
style sheets.

Moving to persistent vs preferred style sheets, most style sheets seem
to be persistent. That is, the link has href="mystyle.css"
rel="stylesheet" type="text/css" However most do not include the
title="whatever", so they are not preferred style sheets. So am I right
in thinking a persistent style sheet is used when you expect that other
style sheets (or styles) may also be used by the HTML document. And a
preferred style sheet would be appropriate where you think it may be
replaced entirely by some other style sheet?

--
http://www.ericlindsay.com
Dec 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Eric Lindsay wrote:
I am trying to understand the differences between and uses of
persistent, default and alternate styles.
There's a good text on this at
http://www.alistapart.com/articles/alternate/ (At least, the use of
alternate stylesheets is explained quite clearly, I'll ignore the
merits or shortcomings of the proposed JS).
So am I right
in thinking a persistent style sheet is used when you expect that other
style sheets (or styles) may also be used by the HTML document. And a
preferred style sheet would be appropriate where you think it may be
replaced entirely by some other style sheet?


Yes, you're right.

* Use a persistent stylesheet for style rules that you want to see
applied at all times.
* Use a preferred stylesheet for style rules that go on top of the
persistent style, and that you propose as a default, but may be changed
when the user selects one of the alternate stylesheets.
* Use alternate stylesheets for styles that can replace the style given
in the preferred stylesheet.

You could imagine having a persistent stylesheet that describes the
general layout of your page, a preferred stylesheet that declares
colours and background images, and an alternate stylesheet that uses
black and white only, and puts borders on certain elements. Note that
you can break up one persistent, preferred or alternate "stylesheet"
into several css files, provided you give them the same title.

Example:

<link rel="stylesheet" type="text/css" href="basiclayout.css" />
<link rel="stylesheet" type="text/css" href="basicfonts.css" />
<link rel="stylesheet" type="text/css" href="fancycolours.css"
title="Merry" />
<link rel="stylesheet" type="text/css" href="fancybackgrounds.css"
title="Merry" />
<link rel="alternate stylesheet" type="text/css" href="b-w.css"
title="Austere" />
<link rel="alternate stylesheet" type="text/css" href="borders.css"
title="Austere" />

I'm not sure how alternate stylesheets are supposed to interact with
stylesheets for different media, nor how they do interact in reality.
I'd guess that the UA that is about to print a page would look only at
the stylesheet links with the applicable media attributes ("print" or
"all"), and determine which of these are persistent, preferred or
alternate.

--
Garmt de Vries.

Dec 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.