嵌入web字体
@font-face模块
描述符 | 值 | 描述 |
---|---|---|
font-family | name | 必需。规定字体的名称。 |
src | URL | 必需。定义字体文件的 URL。 |
font-stretch |
|
可选。定义如何拉伸字体。默认是 "normal"。 |
font-style |
|
可选。定义字体的样式。默认是 "normal"。 |
font-weight |
|
可选。定义字体的粗细。默认是 "normal"。 |
unicode-range | unicode-range | 可选。定义字体支持的 UNICODE 字符范围。默认是 "U+0-10FFFF"。 |
@font-face文件
![](https://images2015.cnblogs.com/blog/712855/201602/712855-20160216141553689-227197343.png)
SVG是由W3C制定的开放标准的图形格式。SVG字体就是使用SVG技术来呈现字体,还有一种gzip压缩格式的SVG字体。
1
2
3
4
5
6
7
8
9
10
|
@font-face { font-family : 'icomoon' ; src : url ( '../font/icomoon.eot' ); /* IE9兼容模式 */ src : url ( '../font/icomoon.eot?#iefix' ) format ( 'embedded-opentype' ), /* IE6~IE8 */ url ( '../font/icomoon.woff' ) format ( 'woff' ), /* 现代浏览器 */ url ( '../font/icomoon.ttf' ) format ( 'truetype' ), /* safari,Android,ios */ url ( '../font/icomoon.svg#icomoon' ) format ( 'svg' ); /* Legacy ios */ font-weight : normal ; font-style : normal ; } |
示例:
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="../css/stylesheet.css" />
<style>
div{
font-family: amadeus_regularamadeusRg;
}
</style>
</head>
<body>
<div>staven</div>
</body>
</html>
@font-face {
font-family: 'amadeus_regularamadeusRg';
src: url('../fonts/amadeus-webfont.eot');
src: url('../fonts/amadeus-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/amadeus-webfont.woff2') format('woff2'),
url('../fonts/amadeus-webfont.woff') format('woff'), url('../fonts/amadeus-webfont.ttf') format('truetype'), url('../fonts/amadeus-webfont.svg#amadeus_regularamadeusRg') format('svg');
font-weight: normal;
font-style: normal;
}
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="../css/style.css" />
</head>
<body>
<div class="icon-firefox"></div>
</body>
</html>
@font-face {
font-family: 'icomoon';
src:url('../fonts/icomoon.eot?7gr0ck');
src:url('../fonts/icomoon.eot?7gr0ck#iefix') format('embedded-opentype'),
url('../fonts/icomoon.ttf?7gr0ck') format('truetype'),
url('../fonts/icomoon.woff?7gr0ck') format('woff'),
url('../fonts/icomoon.svg?7gr0ck#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"], [class*=" icon-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'icomoon' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-film:before {
content: "\e900";
}
.icon-envelop:before {
content: "\1f313";
}
.icon-smile2:before {
content: "\e902";
}
.icon-chrome:before {
content: "\e903";
}
.icon-firefox:before {
content: "\e901";
}
.icon-IE:before {
content: "\e904";
}
.icon-opera:before {
content: "\e905";
}
.icon-safari:before {
content: "\e906";
}
.icon-IcoMoon:before {
content: "\e907";
}
嵌入web字体的更多相关文章
- CSS3之嵌入Web字体
之前如果想在自己的网站使用某些好看的字体,总是迫不得已得在PS里先把字体图片做好.虽然这样做也能达到我们想要的效果,但是这样就增加了HTTP请求(如果在多处使用的话),即使合并所有图片,也不好管理,灵 ...
- 如何使用Web字体?
如何使用Web字体 嵌入Web字体的关键是@font-face规则,通过它可以指定浏览器下载web字体的地址,以及如何在样式表中引用该字体 @font-face { font-family: Voll ...
- 制作web字体:CSS3 @font-face
@font-face是CSS3中的一个模块,他主要是把自己定义的Web字体嵌入到你的网页中,随着@font-face模块的出现,我们在Web的开发中使用字体不怕只能使用Web安全字体,另外@font- ...
- 几种web字体格式
目前,文字信息仍是网站最主要的内容,随着CSS3技术的不断成熟,Web字体逐渐成为话题,这项让未来Web更加丰富多彩的技术拥有多种实现方案,其中之一是通过@font-face属性在网页中嵌入自定义字体 ...
- web设计经验<七>13步打造优雅的WEB字体
今天,大多数浏览器已经默认支持Web字体,日趋增多的字体特性被嵌入最新版HTML和CSS标准中,Web字体即将迎来一个趋于复杂的崭新时代.下面是一些基本的关于字体的规则,特别适用于Web字体. 原文地 ...
- web字体格式及几种在线格式转换工具介绍
原文地址:http://blog.csdn.net/xiaolongtotop/article/details/8316554 目前,文字信息仍是网站最主要的内容,随着CSS3技术的不断成熟,Web字 ...
- 工作笔记——web字体格式转换
转载自:http://blog.csdn.net/xiaolongtotop/article/details/8316554 目前,文字信息仍是网站最主要的内容,随着CSS3技术的不断成熟,Web字体 ...
- WEB 字体
之前如果想在自己的网站使用某些好看的字体,总是迫不得已得在PS里先把字体图片做好.虽然这样做也能达到我们想要的效果,但是这样就增加了HTTP请求 (如果在多处使用的话),即使合并所有图片,也不好管理, ...
- 如何避免由 Web 字体引起的布局偏移
前言 一些布局上的完全加载前后的变化很容易解决:为动态元素预先分配正确的空间,在图像上使用宽度和高度属性,并优先考虑 HTML 文档中的可见元素.但是,导致布局偏移的还有一个难以解决的问题:无样式文本 ...
随机推荐
- logstash的grok正则匹配规则文件
文件路径:logstash/vendor/bundle/jruby/1.9/gems/logstash-patterns-core-4.1.0/patterns/grok-patterns 在线调试g ...
- Python开发基础-Day3-列表、元组和字典
列表 列表定义:[]内以逗号分隔,按照索引,存放各种数据类型,每个位置代表一个元素 特性: 1.可存放多个值 2.可修改指定索引位置对应的值,可变 3.按照从左到右的顺序定义列表元素,下标从0开始顺序 ...
- python--flask框架的安装和简单使用(转)
原文地址:http://blog.csdn.net/xiaowu8858892520/article/details/54428196
- 一个应用 可以有多个application
韩梦飞沙 yue31313 韩亚飞 han_meng_fei_sha 313134555@qq.com 一个应用里面怎样才能有2个application 一个AndroidManifest.xml中可 ...
- 【博弈论】【SG函数】【线段树】Petrozavodsk Summer Training Camp 2016 Day 9: AtCoder Japanese Problems Selection, Thursday, September 1, 2016 Problem H. Cups and Beans
一开始有n个杯子,每个杯子里有一些豆子,两个人轮流操作,每次只能将一个豆子移动到其所在杯子之前的某个杯子里,不过可以移动到的范围只有一段区间.问你是否先手必胜. 一个杯子里的豆子全都等价的,因为sg函 ...
- 【二分】【线段树】hdu6070 Dirt Ratio
size(l,r)表示区间l,r权值的种类数,让你求min{size(l,r)/(r-l+1)}(1<=l<=r<=n). last[r]表示a[r]上一次出现的位置, 就是二分验证 ...
- python基础之带参数装饰器和迭代器
带参数的装饰器:就是在原装饰器外再包一层函数 def auth(driver='file'): def auth2(func): def wrapper(*args,**kwargs): name=i ...
- Codeforces Round #345 (Div. 2) D. Image Preview 暴力 二分
D. Image Preview 题目连接: http://www.codeforces.com/contest/651/problem/D Description Vasya's telephone ...
- iOS 在系统设置中展示Version, Build, Git等信息
在设置中,展示自定义内容,如下图INFO区域内容: 步骤: 1.在项目中添加Settings.bundle文件 Root.plist和Root.plist的Source code如下 ...
- CentOS中如何安装7ZIP
7-zip以高压缩率著称,并且是一款免费开源的压缩软件.在常规的Linux发行版中,无法通过简单的yum命令来安装该软件.那么在CentOS中,如何安装7ZIP呢?有以下3种方法: 第一种,源码编译安 ...