未捕获的语法错误:无效或意外的标记@import css

Hel*_*ili 3 css extjs

编辑:这是一个错字 - 我错误地使用了脚本而不是链接,并且没有注意到。因为已经给出了正确答案,所以即使是愚蠢的问题我也不会删除。我只会接受答案。

我正在尝试学习ExtJS。我写了下面的简单代码。我添加了 neptune 主题 css 文件来设置组件的样式,但出现以下错误:

Uncaught SyntaxError: Invalid or unexpected token
Run Code Online (Sandbox Code Playgroud)

在上述文件内的导入时发生错误:

@import 'theme-neptune-all_1.css';
@import 'theme-neptune-all_2.css';
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

<!DOCTYPE html>
<html>
   <head>
      <script type = "text/javascript" 
         src = "ext-6.6.0-trial/build/classic/theme-neptune/resources/theme-neptune-all.css"></script>
      <script type = "text/javascript" 
         src = "ext-6.6.0-trial/build/ext-all.js"></script>

      <script type = "text/javascript">
         Ext.onReady(function() {
            Ext.create('Ext.Panel', {
               renderTo: 'helloWorldPanel',
               height: 200,
               width: '50%',
               title: 'Hello world',
               html: 'First Ext JS Hello World Program'
            });

         });

      </script>
   </head>

   <body>
      <div id = "helloWorldPanel" />
   </body>
</html>
Run Code Online (Sandbox Code Playgroud)

jma*_*svt 6

你做错的事情是告诉浏览器它要读取 javascript,然后给它 CSS。link您想要使用元素而不是标签加载 CSS script

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link