@import

Browser Internet Explorer Netscape Opera Safari Firefox
Version 5.5 6.0 7.0 8.0 8.0 9.0 7.0 8.0 9.2 9.5 1.3 2.0 3.1 1.5 2.0 3.0
Supported Errors Errors Errors ? Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Short information
CSS CSS2
Default value all
Reference to specification http://www.w3.org/TR/CSS21/cascade.html#at-import

Description
The rule "@import" allows to import CSS file content into a current style sheet.

Syntax

@import url("file name") [types of mediums];
@import ("file name") [types of mediums];

Printers, monitors and other devices are mediums. Some of them are given in the table below.

Tab.1 Medium types and their description
Type Description
all All types. This is a default value.
aural Speech synthesizers and programs for aloud text reproduction, such as speech browsers
braille Devices which are meant for the blinds. These devices are based on the Braille system
handheld Pocket (palm) computers and similar devices
print Printing devices such as the printers
projection Projector
screen Monitor screen
tv TV set

When you use different types of mediums concurrently with file import, you can indicate styles only for certain devices.

Values:
A path to a style file may be used as a value; this path is indicated inside of optional construction "url()". You can write a path to the file either with quotation marks or without them.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
  <title>Импорт стиля</title>
  <style type="text/css">
    @import "/style/main.css" screen; /* Style for result output on the monitor */
    @import "/style/palm.css" handheld, print; /* Style for printing */
  </style>
 </head>
 <body>
  <p>...</p>
 </body>
</html>
Browsers
Browser Internet Explorer to the 7th version inclusive doesn't support mediums types in the time of style file's import.