Web字体用于允许CSS中的字体,这些字体未安装在本地系统上.
Sr.No. | Font&说明 |
---|---|
1 | TrueType Fonts (TTF) TrueType是Apple和Microsoft在20世纪80年代后期开发的大纲字体标准,它成为Windows和MAC操作系统最常用的字体./p> |
2 | OpenType Fonts (OTF) OpenType是可缩放计算机字体的格式,由Microsoft开发 |
3 | The Web Open Font Format (WOFF) WOFF用于开发网页并于2009年开发.现在它正在使用W3C推荐. |
4 | SVG Fonts/Shapes SVG允许在SVG文档中使用SVG字体.我们也可以使用font face属性将CSS应用于SVG. |
5 | Embedded OpenType Fonts (EOT) EOT用于开发网页,并嵌入网页所以不需要允许第三方字体 |
下面的代码显示了font face : 的示例代码;
<html> <head> <style> @font-face { font-family: myFirstFont; src: url(/css/font/SansationLight.woff); } div { font-family: myFirstFont; } </Style> </head> <body> <div>This is the example of font face with CSS3.</div> <p><b>Original Text :</b>This is the example of font face with CSS3.</p> </body> </html>
它将产生以下结果 :
包含以下列表所有字体描述放在@ font-face规则 :
Sr.No. | 价值&说明 |
---|---|
1 | font-family 用于定义字体名称 |
2 | src 用于定义网址 |
3 | font-stretch 用于查找字体应如何拉伸 |
4 | font-style 用于定义字体样式 |
5 | font-weight 用于定义字体粗细(粗体) |