473,785 Members | 2,576 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2148
"Alan J. Flavell" <fl*****@physic s.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*****@physic s.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="someTitl e"...

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

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.cs s" title="April's Style">
<link rel="StyleSheet " href="sheet2.cs s" title="April's Style">
<link rel="Alternate StyleSheet" href="sheet1.cs s"
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
6630
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 ;) input.example { background-color: #fff } and the javascript:
4
6183
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 returns false.?
13
2517
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. I've done this before with Modules, and saw that <gasp> they behave just like sealed classes with only static members. Anyway, it looks like Optional Parameters are nothing but a way to tell the compiler to write some overloads for you. So, in...
1
4353
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 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...
12
2298
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 a good reason.
14
3275
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 make things simpler and better readable I'd make all default parameters named parameters so that you can decide for yourself which one to pass and which not, rather than relying on massively overlaoded methods which hopefully provide the best...
2
11941
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 procedure. We weren't able to declare it with DateTime.MinValue as its default value, as MinValue is a read-only property rather than a constant. To work around, we had to use a "magic date" that we checked for later on. I was never very happy...
12
2674
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 avoided. I'd like to hear your various opinions on this matter.
7
7070
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 As Integer = 0, _ Optional ByVal Arg2 As Integer = 0, _ Optional ByVal Arg3 As Integer = 0) ' Call my SQL proc with the same signature
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10161
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10098
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9958
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7506
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5523
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2890
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.