What does @import do?

I saw this code somewhere, and I wonder what @import do? I do not think this is a server side issue. Is this handled 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> 
+7
source share
3 answers

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 for the @charset rule, if any). See the section on parsing when user agents must ignore @import rules. The keyword '@import' must be followed by a style sheet URI to include. A string is also allowed; it will be interpreted as if it had url (...) around it.

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

+9
source

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

+4
source

loads the CSS styles defined in dojo.css and then defines the optional #lblTitle style

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

+1
source

All Articles