使用CSS导入JavaScript文件

前端之家收集整理的这篇文章主要介绍了使用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.f2er.com/css/216268.html

猜你在找的CSS相关文章