473,652 Members | 3,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6111
In article <pt************ *****@fe39.usen etserver.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="Monochro me 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="addition s">

--
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="alterna te 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="addition s">


"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
8655
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 The ScreenplayCSS is flawed, for several reasons; -overuse of <div id= tags -doesn't scale screen resolutions (convert from px to in, pt ?) -no media="print" (how much coule be shared between "screen" & "print") -no automatic page breaks (with...
10
5249
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 based design, and cannot see my problem. The stylesheet is in the images folder on the same server. (http://www.clergytaxes.com/images/ct.css) Could someone steer me in the right direction please?
7
1389
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 arbitrary record, the graphical display of the table corrupts in FF. I'm at work now so can't do anything useful like upload a picture somewhere, but I can do when I get home. I've checked the source, and its all there, but the table degrades to...
4
2298
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. My CSS file works fine in IE 6.0 when i specify the absolute path. eg- href ="D:\Mywebsite\css\mycssfile.css" but this full path does not work in firefox 1.5.0.5. When I load page in firefox, css file seems to have no effect on page. If I...
9
3809
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 of iframes and populating each iframe which its own copy of the code and a list of items to display. It previously had it working tickety-boo with both IE 6 and Firefox. I've had to concentrate on adding new features to the IE side and am now...
5
10097
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 firefox. Needless to say the code for the page in question is the same. I would like to font size to be the same for both browsers.
6
1888
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 file, activation.js. I have put a script tag in the header, and everything works fine in Internet Explorer 7 and Opera 9. However, the script is not being called in Firefox 2. I can tell that the script is not being called because I put a...
4
4206
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() + this.ResolveUrl("~") + "styles/styledefault.aspx"); %>" />
7
4274
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\" href=\"templates/94076/menu.css\" media=\"screen, print\" />"); document.write("<script src=\"templates/94076/menu.js\" language=\"javascript\" type=\"text/javascript\"></script>"); } else { document.write("<link rel=\"stylesheet\" type=\"text/css\"...
0
8367
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
8279
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8811
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
8589
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
6160
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
5619
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
4145
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1591
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.