使用el资源的css中的jsf 2 url

时间:2014-01-14 21:32:29

标签: jsf-2 el

我是否可以在css中使用EL来访问jsf 2应用程序的resources文件夹中的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

}

1 个答案:

答案 0 :(得分:0)

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

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