css - 未捕获的语法错误 : Invalid or unexpected token @import css

标签 css extjs

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

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

Uncaught SyntaxError: Invalid or unexpected token

错误发生在上述文件中的导入处:

@import 'theme-neptune-all_1.css';
@import 'theme-neptune-all_2.css';

我做错了什么?

<!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>

最佳答案

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

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

关于css - 未捕获的语法错误 : Invalid or unexpected token @import css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53132108/

相关文章:

javascript - jquery给元素添加样式

extjs - 什么是Ext.id()?

Mysql 存储读取 true 或 false 的 bool 值

extjs - 如何在一个请求中加载 TreePanel 中的所有节点(及其子节点)?

javascript - ExtJS 4.0、Django 和 ExtDirect

CSS:当我将 Overflow:hidden 排除在外时,为什么会出现这种情况?

javascript - 我将如何强制更新 div 内容可编辑?

javascript - IOS Chrome 选择框宽度问题

javascript - 在 extjs 3.4 中刷新面板中的数据 View

html - overflow-x 不工作,屏幕上只显示几列