473,698 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Media Type / @Import url

I am trying to use the import method of attaching stlyesheets but I'm
getting strange results.

this is the code I'm using...

<head>
<title>CSS Example</title>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />

<style>
@import url("style/screen2.css") screen;
@import url("style/print.css") print;
</style>

</head>

IE6.0 Does'nt render the styles at all but Opera and Netscape do.

Any ideas???

Thanks

Alun
Jul 20 '05 #1
5 4735
al**@pentangle. co.uk (Alun) wrote:
@import url("style/screen2.css") screen;
@import url("style/print.css") print;

IE6.0 Does'nt render the styles at all but Opera and Netscape do.


UAs are notoriously buggy in their support for CSS media rules,
unsurprisingly IE is again amongst the worst.

What works for me is a combination of linking, importing and media
wrappers inside the css files. I aim to support IE5.5+, Moz and Opera.

Example:
HTML: http://www.pan-europe.utvinternet.ie (also links in a handheld SS)
First SS: http://www.pan-europe.utvinternet.ie/css/one.css
Second SS: http://www.pan-europe.utvinternet.ie/css/two638.css

Note that this method is not spec compliant, a stylesheet that is linked
in without a specified media type is supposed to apply to screen only,
but Opera, Moz and IE all use the print section.

Test extensively in all UAs that *you* want to be compatible with
because of the many bugs.

--
Spartanicus
Jul 20 '05 #2
Alun wrote:
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
This should be set in an http header, not inside the document.
<style>
Style element requires a type attribute:

<style type="text/css">
@import url("style/screen2.css") screen;
@import url("style/print.css") print;


Browsers can be very picky about @import statements. There are
different, equally acceptable syntaxes; try it without quotes, without
"url", etc, and see if that helps.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #3
Spartanicus wrote:

Note that this method is not spec compliant, a stylesheet that is linked
in without a specified media type is supposed to apply to screen only,


Where in the spec does it say this? The media reference I found says
quite the opposite:

<URL:http://www.w3.org/TR/CSS2/cascade.html#x5 >
"In the absence of any media types, the import is unconditional.
Specifying 'all' for the medium has the same effect."

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Jul 20 '05 #4
kchayka <us****@c-net.us> wrote:
Note that this method is not spec compliant, a stylesheet that is linked
in without a specified media type is supposed to apply to screen only,


Where in the spec does it say this? The media reference I found says
quite the opposite:

<URL:http://www.w3.org/TR/CSS2/cascade.html#x5 >
"In the absence of any media types, the import is unconditional.
Specifying 'all' for the medium has the same effect."


http://www.w3.org/TR/html401/present...tml#adef-media
media = media-descriptors [CI]
This attribute specifies the intended destination medium for style
information. It may be a single media descriptor or a comma-separated
list. The default value for this attribute is "screen".

--
Spartanicus
Jul 20 '05 #5
On Mon, 28 Jun 2004 17:37:10 +0100, Spartanicus <me@privacy.net > wrote:
kchayka <us****@c-net.us> wrote:
Note that this method is not spec compliant, a stylesheet that is
linked
in without a specified media type is supposed to apply to screen only,


Where in the spec does it say this? The media reference I found says
quite the opposite:

<URL:http://www.w3.org/TR/CSS2/cascade.html#x5 >
"In the absence of any media types, the import is unconditional.
Specifying 'all' for the medium has the same effect."


http://www.w3.org/TR/html401/present...tml#adef-media
media = media-descriptors [CI]
This attribute specifies the intended destination medium for style
information. It may be a single media descriptor or a comma-separated
list. The default value for this attribute is "screen".


In practice, browser don't handle it this way. Style sheets without media
attribute are handled as 'media=all'.

--
Rijk van Geijtenbeek

The Web is a procrastination apparatus:
It can absorb as much time as is required to ensure that you
won't get any real work done. - J.Nielsen
Jul 20 '05 #6

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

Similar topics

5
20690
by: Richie | last post by:
What I want is to have a link to a file (it could be a .zip, .exe, .jpg, ..txt or even .html) and when the user clicks on it they are prompted with the Save As box, as opposed to it opening in the browser. I think I need to do something like: $fp = fopen($filetooutput, "rb"); $thefile = fread($fp, filesize($thefiletooutput)); header("Content-type: ???/???"); not sure what to put instead of the ??? echo $thefile;
0
1112
by: Henri Sivonen | last post by:
I have written a servlet wrapper and a custom entity resolver for Jing. My code needs to decide whether to instantiate a compact syntax schema reader or an XML syntax schema reader. I would very much like to do the Right Thing. Currently, my code does the following; 1. If the HTTP Content-Type of the schema is application/vnd.relax-ng.rnc, the schema is treated as a compact syntax schema. 2. If the HTTP Content-Type of the schema is...
0
1070
by: James Pickering | last post by:
http://www.w3.org/People/mimasa/test/xhtml/media-types/results -- James Pickering http://jp29.org/ XHTML 1.0 Content negotiation version: http://jp29.org/indexbak.php
1
1383
by: Stan Sainte-Rose | last post by:
Hi, I m trying to use the Visual Web Developper 2005 Express Edition Beta and I have a question about the style sheet. I use to use this syntax with my asp code <style type="text/css" media="all"> @import url('css/usercss.css'); </style>
0
744
by: Mike | last post by:
Hi I'm looking for a way to select the Media Type (i.e Plain) when printing with the System.Drawing.Printing namespace. It's easy to select bin, but how is the Media Type set from within vb .NET /Mike
11
2109
by: Mark | last post by:
Hello I made a site with validated XHTML and CSS. It works fine also. Only in IE i see the site build up without CSS (very fast though) and then the CSS is used to build the page. When i use this it works fine: <link href="styles/site.css" rel="stylesheet" type="text/css" />
0
1479
by: Garmt de Vries-Uiterweerd | last post by:
X-posted to opera.page-authoring, because this is a bit Opera-specific for the moment. F'up to ciwas. I am playing around with dedicated styling for the projection media type.. Currently the only browser to support it is Opera, which uses projection when in full-screen mode. On a website I maintain (http://www.jules-verne.nl/), I have set up some special styles for projection. Not that this specific website really needs it, but...
3
1972
by: Markus | last post by:
Hello While googling for this topic I found lots of advice on how to use @media rules to _hide_ stuff from Mac IE. Anyway, actually _using_ @media to write media specific CSS for both Win and Mac IE 5 seems to be less covered. (I know Mac IE is dead, but some of my audiences possibly still use older computers...) So this is what I tried so far to apply specific style sheets for screen and print:
1
3214
by: jon | last post by:
Hello, I currently have a html and a css file with a @import rule and a url (see example below) test.html <style type="text/css" media="screen"> <!-- @import url("index_files/p7tp_01t.css"); --> <link href="index_files/demo.css" rel="stylesheet" type="text/css"> In my css file I have this:
0
8608
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
9029
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
8897
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
7732
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4370
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
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.