html文件怎么加入TTF字体

html-css012

html文件怎么加入TTF字体,第1张

font_family:TTF字体。并且,你的电脑中要安装TTF字体。

详解:

首先要安装TTF字体:

1、下载TTF字体。

2、复制到【控制面板——字体文件夹里面】

3、在HTML代码中加以调用。"font-family:ttf"

添加普通字体:比如:font-family:"Times New Roman",Georgia,Serif

添加自定义特殊字体:

 第一步

 获取要使用字体的三种文件格式,确保能在主流浏览器中都能正常显示该字体。

.TTF或.OTF,适用于Firefox 3.5、Safari、Opera

.EOT,适用于Internet Explorer 4.0+

.SVG,适用于Chrome、IPhone

 第二步

获取到三种格式的字体文件后,下一步要在样式表中声明该字体,并在需要的地方使用该字体。

特殊字体声明如下:

@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')

}

在页面中需要的地方嵌套使用该字体:

p { font: 13px fontNameRegular, Arial, sans-serif}

h1{font-family: fontNameRegular}