嵌入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 文档中的可见元素.但是,导致布局偏移的还有一个难以解决的问题:无样式文本 ...
随机推荐
- 从Linux下载文件到Windows没有换行问题
这是一个小问题,一般用txt打开文件才会遇到,word打开也是正常(估计其他编程软件打开也正常). 顺便提一下pscp从Linux上下载文件到Windows. C:\Users\xuefei>p ...
- 【BZOJ 4104】【THUSC 2015】解密运算
http://www.lydsy.com/JudgeOnline/problem.php?id=4104 网上题解满天飞,我也懒得写了 #include<cstdio> #include& ...
- JZYZOJ1535 [haoi2014]穿越封锁线
http://172.20.6.3/Problem_Show.asp?id=1535 整体来说是道水题,但是穿过点的判定把我坑得wa了两次,考场上这可是40分的水分啊啊啊. 开始的错误想法:排序后向上 ...
- BZOJ 3343:教主的魔法(分块)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3343 [题目大意] 给出一个数列,有区间加法操作,询问区间大于等于c的数字个数 [题解 ...
- 【深度优先搜索】mr353-取奶
应该是USACO的题目,暂时没有找到对应出处. [题目大意] 农夫约翰要量取 Q(1 <= Q <= 20,000)夸脱(夸脱,quarts,容积单位——译者注) 他的最好的牛奶,并把它装 ...
- 【递推+高精度】POJ2506-Tiling
思路别人那里讲的很清楚了,我就不阐述了.链接 #include<iostream> #include<cstdio> #include<cmath> #includ ...
- Android手机 "已安装了存在签名冲突的同名数据包"
如果你不是开发者:如果你在android上更新一个已经安装过较早版本软件时,安装到最后一步提示你:已安装了存在签名冲突的同名数据包,然后安装失败.这是因为旧版软件的签名信息与新版不一致造成的.你可以卸 ...
- Codeforces Beta Round #3 B. Lorry 暴力 二分
B. Lorry 题目连接: http://www.codeforces.com/contest/3/problem/B Description A group of tourists is goin ...
- Express重定向
var express = require('express'); var app = express(); app.get('/',function(req,res){ res.redirect(' ...
- 通过命名管道协议方式访问群集SQL的一个小问题
原来的单机实例SQL如果开放命名管道协议访问可以在.Net程序的连接字符串中增加“;Net=dbnmpntw"以通过命名管道协议方式访问,但是当迁移到群集SQL后,.net通过它可能无法正常 ...