目前我使用的是@font-face,对不支持的浏览器有一个后备功能:
@font-face
{
font-family: TheSansBlack;
src: local( TheSansBlack ), url( ../fonts/TheSans_TT9_.woff ) format( 'woff' );
}
font-family: TheSansBlack, Arial, Verdana, Helvetica, sans-serif;在某些情况下,回退应该是粗体的,所以我有一些css符号,比如:
#foo
{
font-family: TheSansBlack, Arial, Verdana, Helvetica, sans-serif;
font-weight: bold;
}因为我使用的是一种名为TheSansBlack的字体,所以不需要设置font-weight: bold
但这是行不通的:
@font-face
{
font-family: TheSansBlack;
font-weight: normal;
src: local( TheSansBlack ), url( ../fonts/TheSans_TT9_.woff ) format( 'woff' );
}它仍然显示看起来丑陋的粗体,因为它是TheSansBlack的双重粗体...我只需要在回退时将字体粗细设置为粗体,而不是woff字体。
编辑:我也试过了,但没有成功:
@font-face
{
font-family: TheSansBlack;
src: local( TheSansBlack ), url( ../fonts/TheSans_TT9_.woff ) format( 'woff' );
#foo
{
font-weight: normal !important;
}
}
#foo
{
font-family: TheSansBlack, Arial, Verdana, Helvetica, sans-serif;
font-weight: bold;
}发布于 2012-04-03 16:02:26
明白了:-)
我必须在@font-face中将font-weight显式设置为粗体。
不知道为什么..。
编辑:完整示例
@font-face
{
src: local( TheSansBlack ), url( ../fonts/TheSans_TT9_.woff ) format( 'woff' );
font-family: TheSansBlack;
font-weight: bold;
}
#foo
{
font-family: TheSansBlack, Arial, Verdana, Helvetica, sans-serif;
font-weight: bold;
}这会导致在较旧的浏览器中生成正常的TheSansBlack和粗体Arial/宋体/Helvetica。
https://stackoverflow.com/questions/9974817
复制相似问题