...

View Full Version : Persistent, preferred, and alternate styles



codefox
12-28-2002, 04:23 PM
I just read about persistent, preferred and alternate stylesheets in the html4.01 specification. It says:



HTML allows authors to associate any number of external style sheets with a
document. The style sheet language defines how multiple external style sheets
interact (for example, the CSS "cascade" rules).
Authors may specify a number of mutually exclusive style sheets called alternate
style sheets. Users may select their favorite among these depending on their
preferences. For instance, an author may specify one style sheet designed for small
screens and another for users with weak vision (e.g., large fonts). User agents
should allow users to select from alternate style sheets.
The author may specify that one of the alternates is a preferred style sheet. User
agents should apply the authorís preferred style sheet unless the user has selected
a different alternate.
Authors may group several alternate style sheets (including the authorís preferred
style sheets) under a single style name. When a user selects a named style, the
user agent must apply all style sheets with that name. User agents must not apply
alternate style sheets with a different style name. The section on specifying external
style sheets [p.191] explains how to name a group of style sheets.
Authors may also specify persistent style sheets that user agents must apply in
addition to any alternate style sheet.


I have a preferred stylesheet which is applied for 800x600 screens, an alternate stylesheet for 1024x768 screens, and a persistent one with declarations common to all screens. How do I let the user select a stylesheet?

Thanks.

redhead
12-28-2002, 04:54 PM
ah ha! the ol' style changer... i use one of these on my site. you need to use a little javascript aswell to change between style sheets...

heres a handy link @ a list apart... with a complete script you are able to download at the end. wonderful.

http://www.alistapart.com/stories/alternate/

jkd
12-28-2002, 06:53 PM
A browser should offer the mechanism for you.

In Mozilla or NS6+:
View --> Use Style

Opera 7:
View --> Style

And I think Konqueror might also provide an interface (can't remember). IE/Win does not however.

redhead
12-28-2002, 07:11 PM
A browser should offer the mechanism ...... IE/Win does not however.unfortunatly the majority of poeple do use ie, which is why the script is needed.

jkd
12-28-2002, 07:27 PM
Originally posted by redhead
unfortunatly the majority of poeple do use ie, which is why the script is needed.

I was going to suggest that IE/Win really sucks as a browser, which is why you need to use a script...

It is really unfortunate so many people use the awful piece of software.

Bosko
12-28-2002, 08:34 PM
Yes,Konqueror also support this;
View>Use Stylesheet

I totally agree with jkd,if people used a decent useragent (i.e. Mozilla,Opera,Konqueror) then you wouldn't have to waste your time on making such scripts.

oracleguy
12-29-2002, 01:08 AM
Originally posted by Bosko

I totally agree with jkd,if people used a decent useragent (i.e. Mozilla,Opera,Konqueror) then you wouldn't have to waste your time on making such scripts.

Yeah it is sad. IE should be hit by a bus. (if that were even possible).

redhead
12-29-2002, 06:32 PM
sorry. i only provided a link in answer to a question. i did not mean to start another whole IE/ Moz argument.

jkd
12-29-2002, 07:08 PM
Originally posted by redhead
sorry. i only provided a link in answer to a question. i did not mean to start another whole IE/ Moz argument.

Not really an argument... seems kind of one-sided at the moment. :D

brothercake
12-29-2002, 11:51 PM
It's not one sided at all - there are a whole host of business and interoperability reasons why IE is a great browser.

And lots of technical and standards-support reasons why it both sucks and blows at the same time.

In the words of Obsidian - Choose Your Fate ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum