首页 > 代码库 > css自定义字体

css自定义字体

@font-face {    
  font-family: 华文隶书;    
  src: url( ../font/STLITI.eot ); /* IE */  
  src: url( ../font/STLITI.ttf ) format("truetype");  /* 非IE */  
}  
#nav{width:30px;height:537px;display:block;font-size:18px;text-align:center;margin-left:10px;font-family:"华文隶书";padding-top:0;margin-top:-13px;}

常常看到别人这样声明自定义字体:

@font-face {
font-family: ‘fontNameRegular‘;
src: url(‘fontName.eot‘);
src: local(‘fontName Regular‘),
local(‘fontName‘),
url(‘fontName.woff‘) format(‘woff‘),
url(‘fontName.ttf‘) format(‘truetype‘),
url(‘fontName.svg#fontName‘) format(‘svg‘);
}


@font-face {
font-family: 字体名称;
src: url( 字体.eot ); /* IE */
src: url( 字体.ttf ) format("truetype"); /* 非IE */
}