473,408 Members | 2,813 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,408 software developers and data experts.

optional and default stylesheets


What I was trying to do: to offer a default stylesheet, plus another
small stylesheet which can be applied additionally to the default
one. Preferably, the optional stylesheet should be initially in
effect, but the user should be able to turn it off.

My reading of the HTML4 spec (which is where this seems to be
documented, though I reckon it's on-topic for this group): it seems to
me that what I want, in the terms described there, is one stylesheet
which is what it calls "persistent", defined by *not* having a title
attribute on the link; and one stylesheet which has an informative
title attribute ("trick-ruby" is its title in this case, as it
happens).

If I do just that, then Mozilla (View-> Use Style) loads the page
initially with both stylesheets in effect, and offers me the
opportunity to switch from the style "trick-ruby" to "basic page
style" (which indeed is my default or so-called "persistent"
stylesheet). So that's working as desired.

If I look at the same thing on Firefox (1.5.0.1), it again loads the
page with both stylesheets initially in effect, *but* then it offers
me the choice of switching from my "trick-ruby" to "No style", which
isn't what I intended. Where's my "persistent" stylesheet gone?
So then I tried changing the optional stylesheet from rel="stylesheet"
to rel="alternate stylesheet", even though it isn't really
"alternate".

Now, Mozilla loads the page with only the default stylesheet in
effect initially (which isn't really what I wanted), while offering
the options to display with "basic page style" or with trick-ruby, as
before.

Firefox also loads initially with "basic page style" in effect, but is
now offering *two* other possibilities: No style, or my trick-ruby
sheet.

Opera (8.5) seems to be sort-of consistent with what Mozilla offers,
in either case.

MSIE (if anyone cares) in the alternate-stylesheet situation evidently
hasn't included the trick-ruby optional stylesheet, nor can I see any
UI to select it.
To summarise: if I'm reading the spec aright, then indeed my
default stylesheet should be defined by rel="stylesheet" and no
title attribute; my optional stylesheet should be defined by
rel=stylesheet (NOT rel="alternate stylesheet") and by my choice
of title attribute. Mozilla and Opera 8.5 work as intended, and
even MSIE does what I want initially (just that there doesn't seem
to be a UI for turning the optional stylesheet off).
Would it be going too far to say that Firefox has a user-interface
bug, in as much as under these circumstances it only has the option to
turn off all styles - rather than selectively turning off the optional
one and leaving the so-called "persistent" one alone? The latter
would be my understanding of the term "persistent", after all.

I tried defining the trick-ruby stylesheet both as rel="stylesheet"
and as rel="alternate stylesheet", but it didn't help at all.

(Page is http://ppewww.ph.gla.ac.uk/~flavell/www/umusalu , if anyone
wants to see it, at least in one of the above variations.)
Feb 23 '06 #1
8 2109
"Alan J. Flavell" <fl*****@physics.gla.ac.uk> writes:
What I was trying to do: to offer a default stylesheet, plus another
small stylesheet which can be applied additionally to the default
one. Preferably, the optional stylesheet should be initially in
effect, but the user should be able to turn it off.
Make the optional one preferred and @import the default one in it, and
make the default one an alternate.
it seems to
me that what I want, in the terms described there, is one stylesheet
which is what it calls "persistent",
That's very naughty. :)
If I do just that, then Mozilla (View-> Use Style) loads the page
initially with both stylesheets in effect, and offers me the
opportunity to switch from the style "trick-ruby" to "basic page
style" (which indeed is my default or so-called "persistent"
stylesheet). So that's working as desired.
It depends on what you desire. I remember it as a PITA that it was only
possible in Mozilla to get a real 'basic page style' with that option
when the author was so kind to make her style sheet preferred (and it
wouldn't even remember that for the next page).
If I look at the same thing on Firefox (1.5.0.1), it again loads the
page with both stylesheets initially in effect, *but* then it offers
me the choice of switching from my "trick-ruby" to "No style", which
isn't what I intended. Where's my "persistent" stylesheet gone?


According to HTML 4.01, if memory serves, user agents should provide a
possibility to disregard all style sheets. As CSS becomes more popular
in mainstream authoring, that's becoming rather essential. Authors have
not become smarter over night, after all, they just shoot with new guns
that make bigger wholes.

I wouldn't know that the Firefox behaviour is opposing the spec
anywhere, but I know for sure that I like it :)
--
||| hexadecimal EBB
o-o decimal 3771
--oOo--( )--oOo-- octal 7273
205 goodbye binary 111010111011
Feb 23 '06 #2
On Thu, 23 Feb 2006, Eric B. Bednarz wrote:
"Alan J. Flavell" <fl*****@physics.gla.ac.uk> writes:
What I was trying to do: to offer a default stylesheet, plus
another small stylesheet which can be applied additionally to the
default one. Preferably, the optional stylesheet should be
initially in effect, but the user should be able to turn it off.
Make the optional one preferred and @import the default one in it,
and make the default one an alternate.


Gosh, I see. Should it have been *that* obvious?
it seems to me that what I want, in the terms described there, is
one stylesheet which is what it calls "persistent",


That's very naughty. :)


What, me or they? It wasn't me who chose the term "persistent" for
this.
It depends on what you desire.
Well, I meant it to depend on what the reader desired :-}

But I wanted at least to start them off with my version, and let them
proceed from there. If you see what I mean.
According to HTML 4.01, if memory serves, user agents should provide a
possibility to disregard all style sheets.
Absolutely. And even MSIE has that ability, although it hides it away
in an accessibility menu, in the apparent hope that normal users (if I
dare use that non-PC term) will never find it.
As CSS becomes more popular
in mainstream authoring, that's becoming rather essential.


I didn't for a moment intend to prevent them from doing that, if they
wanted!

Anyhow - the only problem with your clue is that it clashes with my
existing template, which unconditionally feeds a rel="stylesheet" with
no title attribute, into every page. I'll need to adjust the logic of
that, if I'm to achieve what you suggested, without the browser
getting two copies of the wretched^W default stylesheet.
While I was walking home, in fact, I thought perhaps the solution was
this:

* default stylesheet as rel="stylesheet" and no title

* optional stylesheet as rel="stylesheet", title="trick-ruby" ...

* rel="alternate stylesheet" title="no-trick" , but contains nothing

(Hmmm, could one define such an empty stylesheet by missing out the
href, or does one really have to create an empty file and point to
it?).

But then I read your posting. Ho hum. Thanks for the clue!

best
Feb 23 '06 #3
VK

Alan J. Flavell wrote:
To summarise: if I'm reading the spec aright, then indeed my
default stylesheet should be defined by rel="stylesheet" and no
title attribute; my optional stylesheet should be defined by
rel=stylesheet (NOT rel="alternate stylesheet") and by my choice
of title attribute.


Persistent stylesheet is defined as:
<link rel="stylesheet"... // no title

Preferred stylesheet (not optional!) is defined as:
<link rel="stylesheet" title="someTitle"...

Alternate style(s) is defined as:
<link rel="alternate stylesheet" title="someTitle01"...

Note that neither persistent nor preferred are "optional": if both
declared then both have to be applied.

<http://www.w3.org/TR/REC-html40/present/styles.html#h-14.3.2>

Feb 23 '06 #4
Alan J. Flavell wrote:
What I was trying to do: to offer a default stylesheet, plus another
small stylesheet which can be applied additionally to the default
one. Preferably, the optional stylesheet should be initially in
effect, but the user should be able to turn it off.

My reading of the HTML4 spec (which is where this seems to be
documented, though I reckon it's on-topic for this group): it seems to
me that what I want, in the terms described there, is one stylesheet
which is what it calls "persistent", defined by *not* having a title
attribute on the link; and one stylesheet which has an informative
title attribute ("trick-ruby" is its title in this case, as it
happens).

If I do just that, then Mozilla (View-> Use Style) loads the page
initially with both stylesheets in effect, and offers me the
opportunity to switch from the style "trick-ruby" to "basic page
style" (which indeed is my default or so-called "persistent"
stylesheet). So that's working as desired.

If I look at the same thing on Firefox (1.5.0.1), it again loads the
page with both stylesheets initially in effect, *but* then it offers
me the choice of switching from my "trick-ruby" to "No style", which
isn't what I intended. Where's my "persistent" stylesheet gone?
Earlier versions of Mozilla had "No style" instead of "Basic page style"
in its View-> Use style menu but it worked as it does now, i.e. disabled
default and alternate style sheets but left the persistent style sheet
enabled. Of course, this caused no end of consternation to authors who
didn't give their only style sheet a title (so it was a persistent style
sheet) and could see no difference when they selected View-> Use style->
No style!

It seems that Firefox branched from Mozilla when the "No style" option
was in the menu, but instead of changing the menu to describe the action,
the action was changed to match the description.
So then I tried changing the optional stylesheet from rel="stylesheet"
to rel="alternate stylesheet", even though it isn't really
"alternate".

Now, Mozilla loads the page with only the default stylesheet in
effect initially (which isn't really what I wanted), while offering
the options to display with "basic page style" or with trick-ruby, as
before.

Firefox also loads initially with "basic page style" in effect, but is
now offering *two* other possibilities: No style, or my trick-ruby
sheet.
It seems that Mozilla has it wrong while Firefox has a defensible
position. Mozilla doesn't allow the user to disable the persistent style
sheet. "User agents should also allow users to disable the author's
style sheets entirely, in which case the user agent must not apply any
persistent or alternate style sheets."[1]

While Firefox doesn't allow the default style sheet to be disabled if
there is no alternate style sheet, the spec merely says that "user
agents should provide a means for users to view and pick from the list
of alternate styles."[2] Firefox does allow an alternate style sheet to
be selected if there is one specified. While being able to disable
default and alternate style sheets while allowing the persistent style
sheet to remain enabled might be reasonable, that option isn't covered
in the spec.
Opera (8.5) seems to be sort-of consistent with what Mozilla offers,
in either case.
Opera allows you to disable default and alternate style sheets but leave
the persistent style sheet active in "Author mode" (similar to Mozilla),
but it also allows you to diable all author style sheets by switching to
"User mode" (like Firefox).
MSIE (if anyone cares) in the alternate-stylesheet situation evidently
hasn't included the trick-ruby optional stylesheet, nor can I see any
UI to select it.
There is no UI method to select alternate style sheets in IE. However,
all the style sheets are available through IE's DOM, so you can
implement your own style sheet switching through client-side scripting
(assuming the user allows scripting). Alternately, one could build a
style sheet selector toolbar for IE a la the <LINK> Navigation Bar[3]
(or convice the author of the <LINK> bar to include a style sheet
switcher in the next incarnation of his toolbar <g>).
To summarise: if I'm reading the spec aright, then indeed my
default stylesheet should be defined by rel="stylesheet" and no
title attribute; my optional stylesheet should be defined by
rel=stylesheet (NOT rel="alternate stylesheet") and by my choice
of title attribute. Mozilla and Opera 8.5 work as intended, and
even MSIE does what I want initially (just that there doesn't seem
to be a UI for turning the optional stylesheet off).
Mozilla works as intended by you; Firefox works as intended by the spec.
<g> Opera works both ways.
Would it be going too far to say that Firefox has a user-interface
bug, in as much as under these circumstances it only has the option to
turn off all styles - rather than selectively turning off the optional
one and leaving the so-called "persistent" one alone? The latter
would be my understanding of the term "persistent", after all.
"Persistent", as used by the spec, seems to mean persistent across
alternatives. The default style sheet is an alternative; it's just the
alternative that's presented "by default." It seems that Mozilla, with
no way to turn off all style sheets, has the user-interface bug. But
ISTM that the ability to turn off all alternate (including the "default"
alternate) style sheets but leave the persistent style sheet active is a
desirable option. Wouldn't it be nice if Mozilla provided a way to
disable *all* style sheets, per the spec, and Firefox had a way to
disable only alternate style sheets.
I tried defining the trick-ruby stylesheet both as rel="stylesheet"
and as rel="alternate stylesheet", but it didn't help at all.


You could make trick-ruby the default style sheet and have it import the
current persistent style sheet, then make the current persistent style
sheet the alternate style sheet.

---
[1] "14.3.1 Preferred and alternate style sheets"; HTML 4.01
Specification; W3C Recommendation 24 December 1999;
<http://www.w3.org/TR/html401/present/styles.html#h-14.3.1>

[2] "14.3.2 Specifying external style sheets"; ibid;
<http://www.w3.org/TR/html401/present/styles.html#h-14.3.1>

[3] <LINK> Navigation Bar;
<http://www.draig.de/LinkBar/index.en.html>

--
Steve

It is easier to fight for one's principles than to live up to them.
-Alfred Adler
Feb 23 '06 #5
On Thu, 23 Feb 2006, Steve Fulton wrote:

[...]
It seems that Firefox branched from Mozilla when the "No style"
option was in the menu, but instead of changing the menu to describe
the action, the action was changed to match the description.
I see what you mean - thanks.
It seems that Mozilla has it wrong while Firefox has a defensible
position. Mozilla doesn't allow the user to disable the persistent
style sheet.
OK - when I want to disable all stylesheets in Moz, it's no problem -
but that's because I use Chris Pederick's web developer toolbar - as
you say, it's not in the regular user interface...

Yup, I see your reasoning. Would be nice if Firefox had the fuller
range of options though.
Opera allows you to disable default and alternate style sheets but
leave the persistent style sheet active in "Author mode" (similar to
Mozilla), but it also allows you to diable all author style sheets
by switching to "User mode" (like Firefox).
Just so.
You could make trick-ruby the default style sheet and have it import
the current persistent style sheet, then make the current persistent
style sheet the alternate style sheet.
Aha, the second vote for that solution ;-)
<http://www.w3.org/TR/html401/present/styles.html#h-14.3.1>
Yes, I *had* read that in the course of the activity, though perhaps
either too superficially or with the wrong expectations.

Anyhow, in return I offer this handy URL that was just pointed out
elsewhere: http://www.b3ta.com/features/howtopoachanegg/
[SCNR]
[3] <LINK> Navigation Bar;
<http://www.draig.de/LinkBar/index.en.html>


If I used IE as a web browser, I would definitely want one of those.

cheers
Feb 23 '06 #6
On Thu, 23 Feb 2006, VK wrote:
Note that neither persistent nor preferred are "optional": if both
declared then both have to be applied.


Yes, by default, that's right, I can see that now. But when an
"alternate" stylesheet is selected, then it excludes the "preferred"
stylesheet.

So the logical conclusion seems to be that in order to make the
preferred stylesheet user-optional (which is what I wanted to do), it
would be necessary to supply an empty "alternate" stylesheet for them
to select.

The solution offered by Eric and Steve was OK too, of course.

best regards
Feb 24 '06 #7
On Fri, 24 Feb 2006, Alan J. Flavell wrote:
So the logical conclusion seems to be that in order to make the
preferred stylesheet user-optional (which is what I wanted to do), it
would be necessary to supply an empty "alternate" stylesheet for them
to select.


No, see http://www.unics.uni-hannover.de/nht...orestyles.html

--
All free men, wherever they may live, are citizens of Denmark.
And therefore, as a free man, I take pride in the words "Jeg er dansker!"

Feb 24 '06 #8
On Fri, 24 Feb 2006, Andreas Prilop, quoting me:
So the logical conclusion seems to be that in order to make the
preferred stylesheet user-optional (which is what I wanted to do),
it would be necessary to supply an empty "alternate" stylesheet
for them to select.


No, see http://www.unics.uni-hannover.de/nht...orestyles.html


Oh yes, I see! For those who are reading along, the key to Andreas'
solution is:

<link rel="StyleSheet" href="sheet1.css" title="April's Style">
<link rel="StyleSheet" href="sheet2.css" title="April's Style">
<link rel="Alternate StyleSheet" href="sheet1.css"
title="April's Alternate Style">

In my terms: sheet1 represents my default stylesheet, and sheet2
represents my optional stylesheet, which I also wanted to be enabled
by default.

And indeed with this approach, both stylesheets are applied (as
so-called "preferred" stylesheets) by default, but when the alternate
style is selected, only sheet1 is applied.

(And in Mozilla, the "basic page style" selection would in this case
use no stylesheet.)

Thanks - an interesting option.
Feb 24 '06 #9

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

Similar topics

1
by: Philip | last post by:
Hey, Is it possible to get the default value of an element's style.backgroundColor property that's set in a css class? Example, since I'm very tired and can't word that any better ;) ...
4
by: Gerry Abbott | last post by:
Hi All, Im trying to use thie combination but have not had success. Below is the function It tried the following myriskLevel(2,2) myrisklevel(0,0,2) and the ismissing(Three) alwasy...
13
by: William Ryan | last post by:
I just picked up a copy of John Robbins' debugging book and started to look at disassembled code. Anyway, I hate optional Parameters in VB, but I was checking them out to see what IL is created. ...
1
by: Eric Lindsay | last post by:
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...
12
by: Nick Hounsome | last post by:
Can anyone tell me what the rational is for not supporting optional arguments. It is obviously a trivial thing to implement and, since C++ has them, I would not expect them to be omitted without...
14
by: cody | last post by:
I got a similar idea a couple of months ago, but now this one will require no change to the clr, is relatively easy to implement and would be a great addition to C# 3.0 :) so here we go.. To...
2
by: Oenone | last post by:
In our applications, we use the special value of DateTime.MinValue to represent "null dates" throughout all our code. We recently ran into an issue where we wanted an optional date parameter for a...
12
by: pamelafluente | last post by:
Hi guys, In the past I have used several time optional parameters in my function. But Now I am more inclined to think that they are more dangerous than useful, and probably better to be...
7
by: jamesclose | last post by:
My problem is this (apologies if this is a little long ... hang in there): I can define a function in VB.NET with optional parameters that wraps a SQL procedure: Sub Test(Optional ByVal Arg1...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.