第一: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图片
你在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里面加单引号会不会解决问题。
IE 6-8 是不支持 format() 这种格式说明的,只会读取类似 src:url() 这样的格式,所以 IE 6-8 会把第一个引号到最后一个引号之间的内容都当做字体的 URL,结果就会返回一个 404。因此可以加上一个 ?,后面的内容就成为一个查询字符串,解决了 404 的问题。iefix 在这里是类似于注释的东西,你可以随便写。另外在一部分 Apache 服务器中,缺少了 # 会返回 403,所以再加上 #摘抄网上的~