【问题标题】:How to include image into css file using JSF tag如何使用 JSF 标记将图像包含到 css 文件中
【发布时间】:2013-04-23 18:46:32
【问题描述】:

我有这个将背景图片设置为 JSF 页面的 css 文件:

body { padding: 35px; background: #4c4c4c url(images/grad1.png) 0 0 repeat-x; color: #fff; font: 11px/normal Arial, Helvetica; }

我想使用这个标签来包含图片作为 JSF 资源:

<h:graphicImage library="images" name="grad1.png" />

如何将图像作为 JSF 资源包含到 css 文件中?

【问题讨论】:

    标签: css jsf jsf-2


    【解决方案1】:

    假设您的 CSS 文件是通过 &lt;h:outputStylesheet&gt; 加载的,请使用 #{resource} 映射。

    body {
        padding: 35px; 
        background: #4c4c4c url(#{resource['images/grad1.png']}) 0 0 repeat-x; color: #fff; 
        font: 11px/normal Arial, Helvetica;
    }
    

    【讨论】:

      猜你喜欢
      • 2021-03-17
      • 1970-01-01
      • 2015-03-28
      • 1970-01-01
      • 2012-04-19
      • 2016-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多