嵌入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文件
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 文档中的可见元素.但是,导致布局偏移的还有一个难以解决的问题:无样式文本 ...
随机推荐
- HDU 5862 Counting Intersections(离散化 + 树状数组)
Counting Intersections Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/ ...
- win10安装mysql8.0.15
1:下载mysql8.0.15 https://www.mysql.com/downloads/ 2:下载完解压,增加my.ini配置文件 [mysqld] # 设置3306端口 port= # 设置 ...
- MYSQL注入天书之基础知识
第一部分/page-1 Basic Challenges Background-1 基础知识 此处介绍一些mysql注入的一些基础知识. (1)注入的分类---仁者见仁,智者见智. 下面这个是阿德玛表 ...
- 【BZOJ 2186】 2186: [Sdoi2008]沙拉公主的困惑 (欧拉筛,线性求逆元)
2186: [Sdoi2008]沙拉公主的困惑 Description 大富翁国因为通货膨胀,以及假钞泛滥,政府决定推出一项新的政策:现有钞票编号范围为1到N的阶乘,但是,政府只发行编号与M!互质的钞 ...
- [BZOJ3224]普通平衡树(旋转treap,STL-vector)
3224: Tyvj 1728 普通平衡树 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 20328 Solved: 8979[Submit][St ...
- [BZOJ4765]普通计算姬(分块+树状数组)
4765: 普通计算姬 Time Limit: 30 Sec Memory Limit: 256 MBSubmit: 1725 Solved: 376[Submit][Status][Discus ...
- 【树形dp】Godfather
[POJ3107]Godfather Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7212 Accepted: 253 ...
- 【BFS/DFS/YY】派对灯
[luogu1468]派对灯 题目描述 在IOI98的节日宴会上,我们有N(10<=N<=100)盏彩色灯,他们分别从1到N被标上号码. 这些灯都连接到四个按钮: 按钮1:当按下此按钮,将 ...
- [转]web.xml中webAppRootKey
web.xml中webAppRootKey ------------------------------------------------------------------------------ ...
- CDOJ 1281 暴兵的卿学姐 构造题
暴兵的卿学姐 题目连接: http://acm.uestc.edu.cn/#/problem/show/1281 Description 沈宝宝又和卿学姐开始玩SC2了! 自从沈宝宝学会新的阵型后,就 ...