【问题标题】:Add font to css used in jsf将字体添加到 jsf 中使用的 css
【发布时间】:2015-03-17 21:59:40
【问题描述】:

这是我的 css 文件:

@font-face {
    font-family: "yekan";
    src: url("#{resource['css:BFantezy.eot']}");
    src: url("#{resource['css:BFantezy.eot']}?#iefix") format('embedded-opentype'),
        url("#{resource['css:BFantezy.woff']}") format('woff'),
        url("#{resource['css:BFantezy.ttf']}") format("truetype"),
        url("#{resource['css:Yekan.svg.svg']}#BYekan") format('svg');
}
...

我在xhtml 页面中使用这个样式表:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html">
    <h:head>
        <title>Home</title>
        <h:outputStylesheet library="css" name="homeStyle.css"/>
    </h:head>
    <h:body
         some text
    </h:body>
</html>

但字体不受影响,(不渲染)。

字体文件位于src\main\webapp\resources\css 目录中。

【问题讨论】:

    标签: html css jsf


    【解决方案1】:

    您需要将字体应用到样式表中的页面。例如

    body {
        font-family: yekan;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-15
      • 2010-11-07
      • 1970-01-01
      • 1970-01-01
      • 2016-02-29
      • 2017-06-22
      • 2022-08-14
      相关资源
      最近更新 更多