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

/*font-face 格式

@font-face{
  font-family:SingleMaltaRegular;
	src: <source> [<format>][,<source> [<format>]]*;
	font-weight: normal;
	font-style: normal;
 }
*取值说明:
*Your Web FontName:此值指的就是你自定义的字体名称,最好是使用你下载的默认字体,他将被引用到你的 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
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值