【问题标题】:jsf 2 url in css using el resource使用el资源的css中的jsf 2 url
【发布时间】:2014-01-14 21:32:28
【问题描述】:

我应该能够在 css 中使用 EL 来访问 jsf 2 应用程序的资源文件夹中的 img 吗?它似乎不起作用。在我的css中,我有以下内容:

.sectionDivider {
    background-image: "#{resource['default:img/dashes.png']}"; 
    background-position:center; 
    width:100%; 
    background-repeat: repeat-x; 
    height: 1px; 
    overflow: hidden; 

}

当我通过浏览器访问该页面时,没有显示背景图像。当我使用浏览器开发工具查看 CSS 时,CSS 如下所示(缺少背景图像):

.sectionDivider {
WIDTH: 100%; BACKGROUND-REPEAT: repeat-x; BACKGROUND-POSITION: center 50%; HEIGHT: 1px; OVERFLOW: hidden

}

【问题讨论】:

    标签: jsf-2 el


    【解决方案1】:

    我发现了问题。我忘了把 url() 放在背景图像样式中。我改为在下面做,它现在正在工作:

    .sectionDivider {
        background-image: url('#{resource['default:img/dashes.png']}'); 
        background-position:center; 
        width:100%; 
        background-repeat: repeat-x; 
        height: 1px; 
        overflow: hidden; 
    }
    

    【讨论】:

      猜你喜欢
      • 2013-03-13
      • 1970-01-01
      • 2011-12-19
      • 2011-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-02
      • 2013-07-03
      相关资源
      最近更新 更多