css引用字体问题

html-css08

css引用字体问题,第1张

你在eot后面加一个?#iefix试试,我之前也做过css嵌入字体,而且各个浏览器测试也没什么问题,我当时的写法是这样的

@font-face

{

font-family:

'steiner'

src:

url('steiner.eot')

src:

url('steiner.eot?#iefix')

format('embedded-opentype'),

url('steiner.woff')

format('woff'),

url('steiner.ttf')

format('truetype'),

url('steiner.svg#steiner')

format('svg')

font-weight:

normal

font-style:

normal

}

你可以对比一下,另外可以看看在url里面加单引号会不会解决问题。

h1{font-family: ChunkFiveRegular'}

#意思是如何引用

format是为了帮助浏览器识别字体格式,浏览器不会根据后缀名去自动识别字体格式的

字符格式有很多种

truetype,opentype,truetype-aat,embedded-opentype,avg等;

特殊字体一般不是说不能添加,而是考虑到用户电脑上预装的字体有限,所以局限在宋体和微软雅黑两种字体,css属性中有个font属性,例如{font-family:"迷你简菱心"},在装过这个字体的的电脑会有效果,但是再没有装过的电脑可能就是其它字体了,一般会解析为宋体,问题解决一般由两种解决方案。

第一:css3下载字体,代码如下

@font-face

{

font-family:

'自己命名字体名字'

src:

url('字体路径')

src:

url('FileName.eot?#iefix')

format('embedded-opentype'),

/*其它格式*/

url('FileName.woff')

format('woff'),

url('FileName.ttf')

format('truetype'),

url('FileName.svg#FontName')

format('svg')

font-style:

normal

font-weight:

normal

/*设置默认样式*/

}

.aa{font-family:"自己命名字体名字"}

不兼容ie8及以下浏览器

第二:切png图片