W3C home > Mailing lists > Public > www-style@w3.org > August 1997

@page and @media vs. @import

From: Liam Quinn <liam@htmlhelp.com>
Date: Mon, 04 Aug 1997 23:09:37 -0400
Message-Id: <>
To: www-style@w3.org

Now that I've bothered you all enough about WD-acss, it's time to move on 
to WD-print [1]...

I'm not sure how CSS1's @import relates to @page and @media with regard to 
the requirement that "all '@import' statements must occur at the start of 
a style sheet, before any declarations." [2]  @page and @media are not 
declarations, but they contain declarations.  Must @import statements 
therefore occur before any @page and @media statements?

As well, can @import be used within @media?  Could you have a style sheet 
like the following:

@media print {
  @import url(print.css);
  BODY { font-family: Times, serif }
@media screen {
  @import url(screen.css);
  BODY { font-family: Verdana, sans-serif }

As a side issue:  Is the syntax @import "screen.css"; (i.e., without the 
url() notation) valid?  The CSS1 grammar [3] gives [STRING|URL] under 
'import' and one example [4] in the spec offers @import "subs.css";, but 
elsewhere only @import url(foo.css); is used.  If both are valid, why?

Finally, are there any requirements on where @media can occur in a style 
sheet?  Could you use

BODY { font-family: Verdana, sans-serif }
@media screen {
  BODY { background: aqua; color: black }
H1 { text-align: center }
@media screen {
  H1 { text-decoration: blink !important } /* hehe */


[1] http://www.w3.org/TR/WD-print
[2] http://www.w3.org/TR/REC-CSS1#the-cascade
[3] http://www.w3.org/TR/REC-CSS1#appendix-b
[4] http://www.w3.org/TR/REC-CSS1#forward-compatible-parsing

Version: PGP for Personal Privacy 5.0
Charset: noconv


Liam Quinn
===============  http://www.htmlhelp.com/%7Eliam/  ===============
Web Design Group            Enhanced Designs, Web Site Development
http://www.htmlhelp.com/    http://enhanced-designs.com/
======  PGP Key at http://www.htmlhelp.com/%7Eliam/pgp.html  =====
Received on Monday, 4 August 1997 23:08:51 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:44 UTC