使用CSS导入JavaScript文件 [英] Import JavaScript files with CSS

查看:133
本文介绍了使用CSS导入JavaScript文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用CSS导入文件来导入JavaScript页面?

Is it possible to use a CSS import file to import JavaScript pages?

@import url(Script.js);


推荐答案

规范规定网址必须指向样式sheet:

The spec states the URL has to point to a style sheet:


'@import'规则允许用户从其他样式
工作表导入样式规则。任何@import规则必须遵循所有@charset规则,并且在样式表中的
之前的所有其他规则和规则集。 @import
关键字后面必须包含要包括的样式表的URI 。 A
字符串也是允许的;它将被解释为它周围有url(...)

The '@import' rule allows users to import style rules from other style sheets. Any @import rules must follow all @charset rules and precede all other at-rules and rule sets in a style sheet. 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.

CSS3语法规范: http://www.w3.org/TR/css3-syntax/#import

这篇关于使用CSS导入JavaScript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆