Persistent, default and alternate styles

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am trying to understand the differences between and uses of
persistent, default and alternate styles.  I have read 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 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?


Re: Persistent, default and alternate styles

Eric Lindsay wrote:
Quoted text here. Click to load it

There's a good text on this at (At least, the use of
alternate stylesheets is explained quite clearly, I'll ignore the
merits or shortcomings of the proposed JS).

Quoted text here. Click to load it

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.


<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

Garmt de Vries.

Site Timeline