This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Stylesheets > June 2004 > Media Type / @Import url





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Media Type / @Import url
Alun

2004-06-28, 12:15 pm

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
Spartanicus

2004-06-28, 12:15 pm

alun@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
Brian

2004-06-28, 7:17 pm

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/
kchayka

2004-06-28, 7:17 pm

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.
Spartanicus

2004-06-28, 7:17 pm

kchayka <usenet@c-net.us> wrote:

>
>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/presen...html#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
Rijk van Geijtenbeek

2004-06-28, 7:17 pm

On Mon, 28 Jun 2004 17:37:10 +0100, Spartanicus <me@privacy.net> wrote:

> kchayka <usenet@c-net.us> wrote:
>
>
> http://www.w3.org/TR/html401/presen...html#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
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews