7wp
7wp

Reputation: 12674

What does @import do?

I saw this code some where, and I'm wondering what @import supposed to do? I don't think this is a server side thing. Is this processed by the browser??

<style type="text/css">
    @import "http://somedomain/dojo/dojo/resources/dojo.css";

    #lblTitle {
    font-size: 16px;
    color:#ffffff;
    font-weight:bold;
</style>

Upvotes: 8

Views: 1333

Answers (3)

sgtz
sgtz

Reputation: 9009

loads in CSS styles defined in dojo.css, and then defines an additional style #lblTitle

Initially I thought dojo.css might be something to do with http://dojotoolkit.org. But now I don't think so. Just a namespace clash?

Upvotes: 1

Stefan
Stefan

Reputation: 744

This is a css directive which is processed by the browser. It is used to include an external css file. Here is the reference: http://www.w3.org/TR/CSS2/cascade.html#at-import

Upvotes: 4

Gio Borje
Gio Borje

Reputation: 21094

The '@import' rule allows users to import style rules from other style sheets. In CSS 2.1, any @import rules must precede all other rules (except the @charset rule, if present). See the section on parsing for when user agents must ignore @import rules. The '@import' keyword must be followed by the URI of the style sheet to include. A string is also allowed; it will be interpreted as if it had url(...) around it.

From Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification

Upvotes: 9

Related Questions