css3中font-face属性的用法详解

来源:互联网 发布:mysql if与case性能 编辑:程序博客网 时间:2024/05/18 01:18

/*font-face 格式

@font-face{  font-family:SingleMaltaRegular;src: <source> [<format>][,<source> [<format>]]*;font-weight: normal;font-style: normal; }
*取值说明:
*YourWebFontName:此值指的就是你自定义的字体名称,最好是使用你下载的默认字体,他将被引用到你的Web元素中的font-family。如“font-family:"YourWebFontName";”
*source:此值指的是你自定义的字体的存放路径,可以是相对路径也可以是绝路径;
*format:此值指的是你自定义的字体的格式,主要用来帮助浏览器识别,其值主要有以下几种类型:truetype,opentype,truetype-aat,embedded-opentype,avg等;
*weight和style:这两个值大家一定很熟悉,weight定义字体是否为粗体,style主要定义字体样式,如斜体。
*页面调用方法:
第一种方法:&lt;i class="icon-index-max" aria-hidden="true" data-icon="&amp;#xe02b;"&gt;&lt;/i&gt;
第二种方法:&lt;i class="icon-podcast icon-index-max"&gt;&lt;/i&gt;
*/
@font-face {  font-family: 'icomoon';  src: url('../fontface/icomoon.eot');/* IE9 Compat Modes */  src: url('../fontface/icomoon.eot?#iefix') format('embedded-opentype'),/* IE6-IE8 */url('../fontface/icomoon.woff') format('woff'),/* Modern Browsers */url('../fontface/icomoon.ttf') format('truetype'),/* Safari, Android, iOS */url('../fontface/icomoon.dev.svg#icomoon') format('svg');/* Legacy iOS */  font-weight: normal;  font-style: normal;}/* Use the following CSS code if you want to use data attributes for inserting your icons */[data-icon]:before {font-family: 'icomoon'; content: attr(data-icon); speak: none;font-weight: normal;font-variant: normal; text-transform: none;font-style: normal;line-height: 1;-webkit-font-smoothing: antialiased;  }/**font-family:设置文本的字体名称*font-style:设置文本样式*font-variant:设置文本是否大小写。设置文本是否大小写,设置小型大写字母的字体显示文本,这意味着所有的小写字母均会被转换为大写,但是所有使用小型大写字体的字母与其余文本相比,其字体尺寸更小*text-transform:属性控制文本的大小写*font-weight:设置文本的粗细*font-stretch:设置文本是否横向的拉伸变形*font-size:设置文本字体大小*src:设置自定义字体的相对路径或者绝对路径,注意,此属性只能在@font-face规则里使用*-webkit-font-smoothing: 设置字体的抗锯齿或者说光滑度的属性*/

本文转自:http://www.9aixuexi.com/web/cd/arc_36747.html
0 0