微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用CSS导入JavaScript文件

是否可以使用CSS导入文件导入 JavaScript页面
@import url(Script.js);

解决方法

规范声明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

原文地址:https://www.jb51.cc/css/216268.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。