@import Rule

DHTML, HTML, & CSS

 
Click to return to the DHTML, HTML & CSS home page    
@font-face Rule     @media Rule     DHTML Properties    

@import Rule


Imports an external style sheet.

Syntax

HTML@import url(sUrl);
ScriptingN/A

Possible Values

sUrlString that specifies the URL that references a cascading style sheet.

The rule has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see dynamic propertiesInternet Link.

Remarks

The semicolon in the syntax is required; if omitted, the style sheet is not imported properly and an error message is generated.

The @import rule, like the LINK element, links an external style sheet to a document. This helps the Web author establish a consistent "look" across multiple HTML pages. Whereas the LINK element specifies the name of the style sheet to import using its HREF attribute, the @import rule specifies the style sheet definition inside a LINK or a STYLE tag. In the scripting model, this means the owningElement property of the style sheet defined through the @import rule is either a STYLE or a LINK object.

The @import rule should occur at the start of a style sheet, before any declarations. Although Internet Explorer 4.0 allows @import statements to appear anywhere within the style sheet definition, the rules contained within the @import style sheet are applied to the document before any other rules defined for the containing style sheet. This rule order affects expected rendering.

Rules in the style sheet override rules in the imported style sheet.

Example

This example uses the @import rule to import a style sheet located at http://anotherStyleSheet.css.

Sample Code

<STYLE type="css/text">
    @import url(http://anotherStyleSheet.css);
    P {color:blue}
</STYLE>

See Also

imports, link, style, styleSheet


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.