Grails - 内部 CSS 有效,但外部失败
Grails - Internal CSS works, but external fails
在一个 grails 项目中,添加内部工作但如果我将代码复制到外部 CSS 我有,我添加的 CSS 代码不会执行。并不是说对于整个项目,.css 文件已正确加载和显示,但对于我输入为内部 CSS 的特定代码行,如果放在外部 [=44] 中,它们不会执行=] 而不是内部。
GSP 页面:(内部 CSS 正常工作)
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="${resource(dir: 'css', file: 'myStylesheet.css')}" type="text/css"/>
<g:javascript src="employeeFunctions.js"/>
<g:javascript src="Tablesorter/docs/js/jquery-latest.min.js"/>
<g:javascript src="Tablesorter/js/jquery.tablesorter.min.js"/>
<g:javascript src="sortEmployees.js"/>
<style>
table.tablesorter th.tablesorter-headerUnSorted {
background: url('../images/bg.gif') no-repeat center right;
cursor: pointer;
}
table.tablesorter th.tablesorter-headerAsc {
background: url('../images/asc.gif') no-repeat center right;
}
table.tablesorter th.tablesorter-headerDesc {
background: url('../images/desc.gif') no-repeat center right;
}
</style>
</head>
试图在.css文件中传递样式:(外部CSS不执行我添加的代码行)
table.tablesorter th.tablesorter-headerUnSorted {
background: url('../images/bg.gif') no-repeat center right;
cursor: pointer;
}
table.tablesorter th.tablesorter-headerAsc {
background: url('../images/asc.gif') no-repeat center right;
}
table.tablesorter th.tablesorter-headerDesc {
background: url('../images/desc.gif') no-repeat center right;
}
body {
// ...........
}
有趣的是,在内部 CSS,我收到以下警告:
Selector tablesorter-headerUnSorted is never used
Selector tablesorter-headerAsc is never used
Selector tablesorter-headerDesc is never used
但即使出现这些警告,table 也已正确排序!!!
在外部 css 添加这些代码部分后,我收到 0 条警告,外部 css 似乎理解这些选择器,但当我在外部和不在内部 css!!!
内联 CSS
带外部 CSS
背景:url('../images/bg.gif')
检查文件 "bg.gif"。它在正确的位置吗?
example
在一个 grails 项目中,添加内部工作但如果我将代码复制到外部 CSS 我有,我添加的 CSS 代码不会执行。并不是说对于整个项目,.css 文件已正确加载和显示,但对于我输入为内部 CSS 的特定代码行,如果放在外部 [=44] 中,它们不会执行=] 而不是内部。
GSP 页面:(内部 CSS 正常工作)
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="${resource(dir: 'css', file: 'myStylesheet.css')}" type="text/css"/>
<g:javascript src="employeeFunctions.js"/>
<g:javascript src="Tablesorter/docs/js/jquery-latest.min.js"/>
<g:javascript src="Tablesorter/js/jquery.tablesorter.min.js"/>
<g:javascript src="sortEmployees.js"/>
<style>
table.tablesorter th.tablesorter-headerUnSorted {
background: url('../images/bg.gif') no-repeat center right;
cursor: pointer;
}
table.tablesorter th.tablesorter-headerAsc {
background: url('../images/asc.gif') no-repeat center right;
}
table.tablesorter th.tablesorter-headerDesc {
background: url('../images/desc.gif') no-repeat center right;
}
</style>
</head>
试图在.css文件中传递样式:(外部CSS不执行我添加的代码行)
table.tablesorter th.tablesorter-headerUnSorted {
background: url('../images/bg.gif') no-repeat center right;
cursor: pointer;
}
table.tablesorter th.tablesorter-headerAsc {
background: url('../images/asc.gif') no-repeat center right;
}
table.tablesorter th.tablesorter-headerDesc {
background: url('../images/desc.gif') no-repeat center right;
}
body {
// ...........
}
有趣的是,在内部 CSS,我收到以下警告:
Selector tablesorter-headerUnSorted is never used
Selector tablesorter-headerAsc is never used
Selector tablesorter-headerDesc is never used
但即使出现这些警告,table 也已正确排序!!!
在外部 css 添加这些代码部分后,我收到 0 条警告,外部 css 似乎理解这些选择器,但当我在外部和不在内部 css!!!
内联 CSS
带外部 CSS
背景:url('../images/bg.gif')
检查文件 "bg.gif"。它在正确的位置吗?
example