Re: Alternate style sheets in CSS3.

William Birchenough wrote:
> An HTML4 feature that I use is the notion of preferred, persistent, and
> alternate style sheets [1].  Unfortunately, there are three drawbacks to the
> HTML4 approach.  First, every document that I write with alternate stylesheets
> must include the same (sometimes lengthy) block of LINK elements; if I want to
> add a new alternate style, then I have to modify all documents which use these
> styles.  Second, there is no way to group together small variations, so I need
> a separate CSS file for every alternate style sheet.  Third, the approach only
> works with HTML4 and its XHTML descendents, not with more general XML.

Doesn't the xml-stylesheet PI provide all the features of the link tag 
when it comes to stylesheets?

> I have two examples of situations where a slight variation in style is useful.
> First, consider two style sheets which differ only in the base font style, with
> the second allowing users with weak vision to see a larger font.  Second,
> consider a quiz, for which the answers should be invisible when printing unless
> the "Teacher" alternate style has been selected.

Can't you in these cases have just the variations in the alternate 
stylesheets, leaving the rest as persistent styles? Or possibly use the 
same @import in the alternates?

> Therefore, I would propose a pair of a new @-rules to allow alternate styles
> within a single stylesheet.  Roughly speaking, they would have the following
> form:
> 
> 	@preferred
> 	{
> 		/* Ruleset. */
> 	}
> 
> 	@alternate ruleset-title
> 	{
> 		/* Ruleset. */
> 	}
> 
> Note that any styles not enclosed in a @preferred or @alternate block would
> be persistent styles, so there is no need for a @persistent block.

Well, I like the suggestion, but I see some areas it needs polishing in. 
For example, shouldn't the preferred stylesheet have a name too, so that 
you can switch back to it? Second, the preferred stylesheet is one of 
the alternates, so why have a separate @rule for it, when you can simply 
let the first alternate be the preferred one? And for giving the 
possibly of source order independece, have an

     @preferred ruleset-title

rule that simply tells the user agent which alternate block is the 
default preferred one.


> Also note that if the ruleset includes a @media block, then this achieves the
> same functionality as the media attribute in the LINK element.

Well, if you want to create a full analogy you would need to add support 
for some things, like @import, within these blocks.

> The "ruleset-title" is a string (wrapped in quotes if it includes spaces,
> just like a font family) which the user agent may display to the user to allow
> the user to select the block.  It corresponds to the use of the "title"
> attribute in the LINK element.
> 
> Unless the user indicates otherwise, the user agent should apply the styles in
> the @preferred block.  User agents should allow the user to select among the
> alternate styles as well.  If an alternate style is selected, styles from other
> @alternate blocks and @preferred blocks should not be displayed.

One of the things I see lacking in the method specified in the HTML 
alternate stylesheets syntax is that you cannot have independent classes 
of alternates - take for example the case where you may want to have 
separate font size, layout, and colour scheme variations. In the 
currrent model, you need to have one alternate for each combination. If 
we're doing this addition to CSS anyway, why not compensate for this 
lack in the HTML alternate stylesheets? I'd suggest adding either nested 
alternates, so that you can chose an alternate within another alternate; 
or better, since they are entirely independent of eachother, add a kind 
of alternate classes/categories so that you chose a preferred style in 
each of the classes, independent of the other classes. Something like this:

     @preferred [class:]title (,[class:]title)+;

     @alternate [class:]title {
         /* rules */
     }
-- 
David "liorean" Andersson

ViewStyles, ViewScripts, SwitchStyles and GraphicsInfo bookmarklets:
<http://liorean.web-graphics.com/>
Hangouts:
<http://codingforums.com/> <http://yourmusicforums.com/>

Received on Sunday, 22 February 2004 08:37:55 UTC