user3808021
user3808021

Reputation:

Add font to css used in jsf

Here is my css file:

@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');
}
...

And i am using this stylesheet in xhtml page:

<?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>

But font not affected, (not rendered).

Font files are in src\main\webapp\resources\css directory.

Upvotes: 1

Views: 748

Answers (1)

Leo Farmer
Leo Farmer

Reputation: 7910

You need to apply your font to your page in your style sheet. e.g.

body {
    font-family: yekan;
}

Upvotes: 2

Related Questions