由sanitizer拒绝的html字体(mozilla调试)

时间:2016-07-15 01:06:39

标签: html css

根据mozilla调试器中的消息,清理程序拒绝了该字体。其他字体有效。 HTML和css都经过验证,但字体仍然不起作用。

@font-face {
   font-family: "parisr";
   src: url("parisr.woff") format("woff");
}

p
{
	font-family : "parisr";
}
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>INDEX.HTML</title>	
			<link rel="stylesheet" href="style.css">
			<style type="text/css"></style>
	</head>
	<body>
		<p>With CSS3, websites can finally use fonts other than the pre-selected "web-safe" fonts. Internet Explorer 8 and earlier, do not support the @font-face rule.</p>
		<div id="element1"></div>
		<div id="element2"></div>
		<div id="element3"></div>
	</body>
</html>

1 个答案:

答案 0 :(得分:0)

好吧因为网页字体不完全是因为css3,因为安全原因字体可能很危险。像firefox这样的浏览器只允许来自域的字体,例如,如果您运行的网站可以通过mywebsite.com和mywebsite.com.au等2个域获取,则必须从这些域提供字体。

你这样做就像你在样式表中所做的那样,但要确保字体的url是正确的。上面的css声明该字体的url是yourwebsite.com/parsir.woff,如果这是正确的那么好,但你可能还需要你可以在这里做的其他版本https://www.web-font-generator.com/