将字体添加到jsf中使用的css
Add font to css used in jsf
这是我的 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
目录中。
您需要按照您的风格将字体应用到您的页面 sheet。例如
body {
font-family: yekan;
}
这是我的 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
目录中。
您需要按照您的风格将字体应用到您的页面 sheet。例如
body {
font-family: yekan;
}