CSS2 » Other » @import

Version: Level 2

Compability: IE5+  N6+

Syntax:
@import url(address) media-type, ... ;

The @import at-rule allows you to designate an external style sheet file to be used with an HTML document.

The syntax for an at-rule is an @ symbol, followed immediately by an unique identifier, which in turn is followed by the block which contains content that is applied on a document level. The block syntax is either:

  • all content contained between a pair of curly brackets,
  • or is all content contained between the unique identifier and a semi-colon.
There are five at-rules: @charset, @font-face, @import. @media, and @page.
 
The mandatory url(address) component is the url address of the external style sheet file. The opening and closing parentheses are required.
 
The optional media-type component is a list of zero or more media types which are deliniated (separated) by commas. Some of the permitted values are:
  • all - the default.
  • aural - speech synthesizers.
  • braille - braille tactile feedback devices.
  • embossed - paged braille printers.
  • handheld - handheld devices.
  • print - printed paged and print preview.
  • projection - projectors or print to transparencies.
  • screen - color computer screens.
  • tty - teletypes.
  • tv - television-type devices.
This file has the same CSS style rules as the DevGuru site.
 

Examples

Code:
<html>
<head>
<title>@media test</title>
<style type="text/css">
@import url(http://www.devguru.com/include/STYLERULES.css);
</style>
</head>
<body>
<p>
I love <a href="http://www.devguru.com">DevGuru</a>!
</p>
</body>
</html>
Explanation:

This file has the same CSS style rules as the DevGuru site.

Language(s): CSS2

See Also: