473,412 Members | 3,763 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,412 software developers and data experts.

Firefox and stylesheet media

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

Jul 21 '05 #1
5 6090
In article <pt*****************@fe39.usenetserver.com>,
David Trimboli <tr******@cshl.edu> wrote:
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
hs******@iki.fi
http://iki.fi/hsivonen/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html
Jul 21 '05 #2
David Trimboli <tr******@cshl.edu> wrote:
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....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

Jul 21 '05 #3
Steve Pugh wrote:
David Trimboli <tr******@cshl.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....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

Jul 21 '05 #4
Tim
On Mon, 03 Jan 2005 17:59:39 +0000,
Steve Pugh <st***@pugh.net> posted:
By setting a title you've made the stylesheet in question preferred
rather than persistant. See
http://www.w3.org/TR/html401/present....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.
Jul 21 '05 #5
Tim wrote:
Steve Pugh wrote:
By setting a title you've made the stylesheet in question preferred
rather than persistant. See
http://www.w3.org/TR/html401/present....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.
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."
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

Jul 21 '05 #6

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

Similar topics

48
by: David J Patrick | last post by:
I'm trying to rewrite the CSS used in http://s92415866.onlinehome.us/files/ScreenplayCSSv2.html. using the w3.org paged media standards as described at http://www.w3.org/TR/REC-CSS2/page.html ...
10
by: Russ Wickstrom | last post by:
I have a webpage (http://www.clergytaxes.com/taxwarn.html) that looks fine in IE but isn't applying any of the style in Firefox. I am still in the process of converting this site to a stylesheet...
7
by: reclusive monkey | last post by:
Hello Everyone, Just wondering if anyone here has experienced this. I have a (fairly) long XML file with just under a thousand records in it. The XSL works fine in IE/FF, however, at a seemingly...
4
by: puja | last post by:
hi all, I have an asp.net website where am including .css file dynamically on page load event. For diff users, there is diff CSS file. So after user logs in, I am setting CSS href on page load....
9
by: johnd126 | last post by:
I have a cgi program which outputs a fairly hefty amount of html/javascript for doing a complex slide show sorta thing in a variety of areas in the browser. I accomplish this by creating a series...
5
by: eholz1 | last post by:
Hello , I have a web page that has a div element, with css applied to that element. Within the div is an ul with li tags, etc. the displayed font size in IE is larger than the the font size in...
6
by: davidiwharper | last post by:
Hi there. I'm putting together a page to collect some information from our website users and send the administrator an email. To this end I have some Javascript form validation in an external...
4
by: coconet | last post by:
Server is Win2K3/IIS6. I have an ASPX page with this in the <headtag: <link rel="stylesheet" type="text/css" href="<% Response.Write( "http://" + Request.ServerVariables.ToString() +...
7
by: labmonkey111 | last post by:
I'm having trouble with the following code: <SCRIPT> <!-- if (navigator.appName == 'Microsoft Internet Explorer') { document.write("<link rel=\"stylesheet\" type=\"text/css\"...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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...
0
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...

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.