一、定义字体
css: 允许自定义字体库的一个属性
@font-face: 自定义字体信息
format: 指定自定义的字体的格式
指定字体的路径和字体格式: src:url("fonts/icomoon.eot");
二、常见的字体格式:format括号里要写的东西
eot: 兼容IE4以上的字体格式
turetype: (.ttf)格式 IE9以上,firefox;
opentype: (.otf)格式 欧朋,火狐 safari;
woff: (.woff)格式 欧朋,火狐 safari 谷歌;
svg: (.svg)格式 是基于SVG字体渲染的一种格式:是chrome4以上,safari,opera(欧朋)。
三、引用字体图标
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
@font-face {
font-family: "erhei";
src:url("fonts/icomoon.eot");
src: url("fonts/icomoon.svg") format('svg'),
url("fonts/icomoon.ttf") format("truetype"),
url("fonts/icomoon.woff") format("woff");
}
/*使用字体*/
span {
font-family: "erhei";
font-size: 45px;
}
/*伪元素*/
span::before {
content: "\e905";
}
</style>
</head>
<body>
<span></span>
</body>
</html>