2017-09-06 49 views
0

在grails項目中,添加內部工程,但如果我將代碼複製到外部CSS中,我添加的CSS代碼不會執行。對於整個項目來說,.css文件是正確加載並顯示的,但對於我輸入爲內部CSS的特定行代碼,如果放置在外部CSS而不是內部,則它們不會執行。Grails - 內部CSS工作,但外部失敗

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不執行的我添加幾行代碼)

什麼是有趣的是,在內部CSS,我得到以下警告:

Selector tablesorter-headerUnSorted is never used 
Selector tablesorter-headerAsc is never used 
Selector tablesorter-headerDesc is never used 

但即使這些警告出現,表正確排序!

在外部CSS添加這些代碼部分後,我得到0警告和外部CSS似乎理解這些選擇器,但他們不執行,而我有這些行在外部,而不是在內部的CSS!

帶內嵌CSS

enter image description here

隨着外部CSS

enter image description here

回答

2

背景:網址( '../圖像/ bg.gif')

檢查文件「bg。 GIF」。它在正確的位置嗎?

example

相關問題