HighDots Forums  

Firefox and stylesheet media

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Firefox and stylesheet media in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David Trimboli
 
Posts: n/a

Default Firefox and stylesheet media - 01-03-2005 , 12:41 PM






I'm writing HTML 4.01 and CSS 2 pages that include a CSS-driven pop-up
menu. What I'm trying to do is create a screen style that uses the
menu, links, etc. normally, and a print style that removes all of this
and just presents the main content.

I'm pretty sure all my code is up to spec (everything validates), even
if the design isn't heart-stopping. However, Firefox seems to choke on
the stylesheets. When the screen style is declared first and the print
style declared second, it displays the screen style correctly and
doesn't use the print style at all. When the print style is declared
first and the screen style is declared second, it doesn't apply any
style on screen or in print.

Netscape 7.2 has the same problem. On the other hand, Internet Explorer
interprets the styles absolutely correctly, no matter what order the
styles are declared in.

Is Mozilla deficient in styles in this way (I couldn't find anything
documented about it at mozilla.org or Mozillazine)? Or is Internet
Explorer doing something it's not supposed to do, and my code is wrong
somehow?

I've put a sample page on the Internet. Please advise me!

http://members.aol.com/dtrimboli/temp/whatkind.html

David
Stardate 5009.5


Reply With Quote
  #2  
Old   
Henri Sivonen
 
Posts: n/a

Default Re: Firefox and stylesheet media - 01-03-2005 , 12:50 PM






In article <ptfCd.4711$PT1.2473 (AT) fe39 (DOT) usenetserver.com>,
David Trimboli <trimboli (AT) cshl (DOT) edu> wrote:

Quote:
I've put a sample page on the Internet. Please advise me!

http://members.aol.com/dtrimboli/temp/whatkind.html
My unverified guess is that the problem is with the two style sheet
links having a different title.

--
Henri Sivonen
hsivonen (AT) iki (DOT) fi
http://iki.fi/hsivonen/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html


Reply With Quote
  #3  
Old   
Steve Pugh
 
Posts: n/a

Default Re: Firefox and stylesheet media - 01-03-2005 , 12:59 PM



David Trimboli <trimboli (AT) cshl (DOT) edu> wrote:

Quote:
I'm writing HTML 4.01 and CSS 2 pages that include a CSS-driven pop-up
menu. What I'm trying to do is create a screen style that uses the
menu, links, etc. normally, and a print style that removes all of this
and just presents the main content.

I'm pretty sure all my code is up to spec (everything validates), even
if the design isn't heart-stopping. However, Firefox seems to choke on
the stylesheets. When the screen style is declared first and the print
style declared second, it displays the screen style correctly and
doesn't use the print style at all. When the print style is declared
first and the screen style is declared second, it doesn't apply any
style on screen or in print.
It's because you've given your stylesheets titles.

<LINK type="text/css" rel="stylesheet" href="blue.css"
title="Monochrome Blue" media="screen">
<LINK type="text/css" rel="stylesheet" href="print.css"
title="Printed Page" media="print">

By setting a title you've made the stylesheet in question preferred
rather than persistant. See
http://www.w3.org/TR/html401/present/styles.html#h-14.3.2

This facet of stylesheet use is complicated and a bit of a mess.
So best advice is to not set titles on link elements to stylesheets
unless you really need to (i.e. if you have alternate (sic)
stylesheets).

Steve



Reply With Quote
  #4  
Old   
David Trimboli
 
Posts: n/a

Default Re: Firefox and stylesheet media - 01-03-2005 , 01:49 PM



Steve Pugh wrote:
Quote:
David Trimboli <trimboli (AT) cshl (DOT) edu> wrote:

I'm pretty sure all my code is up to spec (everything validates), even
if the design isn't heart-stopping. However, Firefox seems to choke on
the stylesheets. When the screen style is declared first and the print
style declared second, it displays the screen style correctly and
doesn't use the print style at all. When the print style is declared
first and the screen style is declared second, it doesn't apply any
style on screen or in print.


It's because you've given your stylesheets titles.

By setting a title you've made the stylesheet in question preferred
rather than persistant. See
http://www.w3.org/TR/html401/present/styles.html#h-14.3.2
Ohhhhh! Geez, it figures my problem was with a special exception.

Thanks, that fixes the problem.

David
Stardate 5009.6



Reply With Quote
  #5  
Old   
Tim
 
Posts: n/a

Default Re: Firefox and stylesheet media - 01-04-2005 , 06:28 AM



On Mon, 03 Jan 2005 17:59:39 +0000,
Steve Pugh <steve (AT) pugh (DOT) net> posted:

Quote:
By setting a title you've made the stylesheet in question preferred
rather than persistant. See
http://www.w3.org/TR/html401/present/styles.html#h-14.3.2
There's more to it than that. You need to specify them as rel="alternate
stylesheet" for them to be alternates, whatever's specified as just
rel="stylesheet" is a default stylesheet (i.e. is applied) until an
alternate is deliberately picked.

So, in theory (browser odd behaviour notwithstanding), something like the
following should mean all the stylesheets are applied:

<link rel="stylesheet" href="/design.css" title="design">
<link rel="stylesheet" href="/colours.css" title="colours">
<link rel="stylesheet" href="/additions.css" title="additions">

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.


Reply With Quote
  #6  
Old   
Steve Pugh
 
Posts: n/a

Default Re: Firefox and stylesheet media - 01-04-2005 , 09:11 AM



Tim wrote:
Steve Pugh wrote:

Quote:
By setting a title you've made the stylesheet in question preferred
rather than persistant. See
http://www.w3.org/TR/html401/present/styles.html#h-14.3.2

There's more to it than that. >You need to specify them as
rel="alternate stylesheet" for them to be alternates,
True but that's only the beginning of it. As I indicated in my original
post it's more complicated.

Quote:
whatever's specified as just rel="stylesheet" is a default stylesheet

(i.e. is applied) until an alternate is deliberately picked.
Not true. As you would have seen if you had read the part of the spec
that I pointed to.

If a title is specified then the stylesheet becomes preferred:
"To make a style sheet preferred, set the rel attribute to "stylesheet"
and name the style sheet with the title attribute."

Quote:
So, in theory (browser odd behaviour notwithstanding), something like
the
following should mean all the stylesheets are applied:

link rel="stylesheet" href="/design.css" title="design"
link rel="stylesheet" href="/colours.css" title="colours"
link rel="stylesheet" href="/additions.css" title="additions"
"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 should provide a means for users to view and pick from the
list of alternate styles. The value of the title attribute is
recommended as the name of each choice."

"If two or more LINK elements specify a preferred style sheet, the
first one takes precedence."

So you've specified three preferred stylesheets. Only the first should
be used. If you want all three to be used then either give them all the
same title (thus making them all members of the same preferred group)
or remove the titles (thus making them all persistent).

Steve



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.