热门关键字:
jquery > jquery教程 > css3 > 网友欢欢分享css3中font-face属性的用法详解

网友欢欢分享css3中font-face属性的用法详解

10590
作者:管理员
发布时间:2013/9/11 15:46:00
评论数:1
转载请自觉注明原文:http://www.jq-school.com/Show.aspx?id=337

/*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: 设置字体的抗锯齿或者说光滑度的属性
*/

/* Use the following CSS code if you want to have a class per icon */
/*
Instead of a list of all class selectors,
you can use the generic selector below, but it's slower:
[class*="icon-"] {
*/
.icon-home, .icon-office, .icon-pencil, .icon-pencil-2, .icon-connection, .icon-bullhorn, .icon-newspaper, .icon-images, .icon-camera, .icon-file, .icon-profile, .icon-file-2, .icon-library, .icon-books, .icon-book, .icon-feed, .icon-podcast, .icon-pacman, .icon-folder, .icon-folder-open, .icon-tags, .icon-qrcode, .icon-cart, .icon-cart-2, .icon-credit, .icon-coin, .icon-support, .icon-calendar, .icon-calendar-2, .icon-alarm, .icon-alarm-2, .icon-map, .icon-map-2, .icon-location, .icon-location-2, .icon-pushpin, .icon-envelop, .icon-notebook, .icon-address-book, .icon-phone-hang-up, .icon-phone, .icon-print, .icon-keyboard, .icon-screen, .icon-laptop, .icon-mobile, .icon-mobile-2, .icon-tablet, .icon-tv, .icon-box-add, .icon-box-remove, .icon-disk, .icon-users, .icon-bubbles, .icon-bubbles-2, .icon-bubbles-3, .icon-reply, .icon-forward, .icon-redo, .icon-undo, .icon-spinner, .icon-binoculars, .icon-zoom-in, .icon-expand, .icon-contract, .icon-expand-2, .icon-contract-2, .icon-key, .icon-lock, .icon-unlocked, .icon-food, .icon-glass, .icon-gift, .icon-bars, .icon-stats, .icon-cog, .icon-cogs, .icon-cog-2, .icon-equalizer, .icon-settings, .icon-fire, .icon-remove, .icon-remove-2, .icon-briefcase, .icon-airplane, .icon-truck, .icon-road, .icon-accessibility, .icon-power-cord, .icon-eye-blocked, .icon-eye, .icon-attachment, .icon-flag, .icon-lightning, .icon-link, .icon-globe, .icon-upload, .icon-download, .icon-cloud-upload, .icon-cloud-download, .icon-cloud, .icon-eye-2, .icon-bookmarks, .icon-bookmark, .icon-star, .icon-star-2, .icon-star-3, .icon-heart, .icon-heart-2, .icon-heart-broken, .icon-thumbs-up, .icon-thumbs-up-2, .icon-forward-2, .icon-backward {
	font-family: 'icomoon';
	speak: none;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	line-height: 1;
	font-style: normal;
	-webkit-font-smoothing: antialiased;
}
.icon-home:before {
	content: "\e000";
}
.icon-office:before {
	content: "\e001";	
}
.icon-pencil:before {
	content: "\e002";
}
.icon-pencil-2:before {
	content: "\e003";
}
.icon-connection:before {
	content: "\e004";
}
.icon-bullhorn:before {
	content: "\e005";
}
.icon-newspaper:before {
	content: "\e006";
}
.icon-images:before {
	content: "\e007";
}
.icon-camera:before {
	content: "\e008";
}
.icon-file:before {
	content: "\e009";
}
.icon-profile:before {
	content: "\e00a";
}
.icon-file-2:before {
	content: "\e00b";
}
.icon-library:before {
	content: "\e00c";
}
.icon-books:before {
	content: "\e00d";
}
.icon-book:before {
	content: "\e00e";
}
.icon-feed:before {
	content: "\e00f";
}
.icon-podcast:before {
	content: "\e010";
}
.icon-pacman:before {
	content: "\e013";
}
.icon-folder:before {
	content: "\e011";
}
.icon-folder-open:before {
	content: "\e012";
}
.icon-tags:before {
	content: "\e014";
}
.icon-qrcode:before {
	content: "\e015";
}
.icon-cart:before {
	content: "\e016";
}
.icon-cart-2:before {
	content: "\e017";
}
.icon-credit:before {
	content: "\e018";
}
.icon-coin:before {
	content: "\e019";
}
.icon-support:before {
	content: "\e01a";
}
.icon-calendar:before {
	content: "\e01b";
}
.icon-calendar-2:before {
	content: "\e01c";
}
.icon-alarm:before {
	content: "\e01d";
}
.icon-alarm-2:before {
	content: "\e01e";
}
.icon-map:before {
	content: "\e01f";
}
.icon-map-2:before {
	content: "\e020";
}
.icon-location:before {
	content: "\e021";
}
.icon-location-2:before {
	content: "\e022";
}
.icon-pushpin:before {
	content: "\e023";
}
.icon-envelop:before {
	content: "\e024";
}
.icon-notebook:before {
	content: "\e025";
}
.icon-address-book:before {
	content: "\e026";
}
.icon-phone-hang-up:before {
	content: "\e027";
}
.icon-phone:before {
	content: "\e028";
}
.icon-print:before {
	content: "\e029";
}
.icon-keyboard:before {
	content: "\e02a";
}
.icon-screen:before {
	content: "\e02b";
}
.icon-laptop:before {
	content: "\e02c";
}
.icon-mobile:before {
	content: "\e02d";
}
.icon-mobile-2:before {
	content: "\e02e";
}
.icon-tablet:before {
	content: "\e02f";
}
.icon-tv:before {
	content: "\e030";
}
.icon-box-add:before {
	content: "\e031";
}
.icon-box-remove:before {
	content: "\e032";
}
.icon-disk:before {
	content: "\e033";
}
.icon-users:before {
	content: "\e034";
}
.icon-bubbles:before {
	content: "\e035";
}
.icon-bubbles-2:before {
	content: "\e036";
}
.icon-bubbles-3:before {
	content: "\e037";
}
.icon-reply:before {
	content: "\e038";
}
.icon-forward:before {
	content: "\e039";
}
.icon-redo:before {
	content: "\e03a";
}
.icon-undo:before {
	content: "\e03b";
}
.icon-spinner:before {
	content: "\e03c";
}
.icon-binoculars:before {
	content: "\e03d";
}
.icon-zoom-in:before {
	content: "\e03e";
}
.icon-expand:before {
	content: "\e03f";
}
.icon-contract:before {
	content: "\e040";
}
.icon-expand-2:before {
	content: "\e041";
}
.icon-contract-2:before {
	content: "\e042";
}
.icon-key:before {
	content: "\e043";
}
.icon-lock:before {
	content: "\e044";
}
.icon-unlocked:before {
	content: "\e045";
}
.icon-food:before {
	content: "\e046";
}
.icon-glass:before {
	content: "\e047";
}
.icon-gift:before {
	content: "\e048";
}
.icon-bars:before {
	content: "\e049";
}
.icon-stats:before {
	content: "\e04a";
}
.icon-cog:before {
	content: "\e04b";
}
.icon-cogs:before {
	content: "\e04c";
}
.icon-cog-2:before {
	content: "\e04d";
}
.icon-equalizer:before {
	content: "\e04e";
}
.icon-settings:before {
	content: "\e04f";
}
.icon-fire:before {
	content: "\e050";
}
.icon-remove:before {
	content: "\e051";
}
.icon-remove-2:before {
	content: "\e052";
}
.icon-briefcase:before {
	content: "\e053";
}
.icon-airplane:before {
	content: "\e054";
}
.icon-truck:before {
	content: "\e055";
}
.icon-road:before {
	content: "\e056";
}
.icon-accessibility:before {
	content: "\e057";
}
.icon-power-cord:before {
	content: "\e058";
}
.icon-eye-blocked:before {
	content: "\e059";
}
.icon-eye:before {
	content: "\e05a";
}
.icon-attachment:before {
	content: "\e05b";
}
.icon-flag:before {
	content: "\e05c";
}
.icon-lightning:before {
	content: "\e05d";
}
.icon-link:before {
	content: "\e05e";
}
.icon-globe:before {
	content: "\e05f";
}
.icon-upload:before {
	content: "\e060";
}
.icon-download:before {
	content: "\e061";
}
.icon-cloud-upload:before {
	content: "\e062";
}
.icon-cloud-download:before {
	content: "\e063";
}
.icon-cloud:before {
	content: "\e064";
}
.icon-eye-2:before {
	content: "\e065";
}
.icon-bookmarks:before {
	content: "\e066";
}
.icon-bookmark:before {
	content: "\e067";
}
.icon-star:before {
	content: "\e068";
}
.icon-star-2:before {
	content: "\e069";
}
.icon-star-3:before {
	content: "\e06a";
}
.icon-heart:before {
	content: "\e06b";
}
.icon-heart-2:before {
	content: "\e06c";
}
.icon-heart-broken:before {
	content: "\e06d";
}
.icon-thumbs-up:before {
	content: "\e06e";
}
.icon-thumbs-up-2:before {
	content: "\e06f";
}
.icon-forward-2:before {
	content: "\e070";
}
.icon-backward:before {
	content: "\e071";
}






如果您觉得本文的内容对您的学习有所帮助:支付鼓励



关键字:css3 font-face font-face的用法 font-family
友荐云推荐