如果用户的计算机安装了"Segoe UI"字体,我希望在网站中使用它。
我已经声明了所有样式,并使用@font-face
来使用font-weight
属性改变字体厚度(这是一个非常酷的功能!)。
问题是我不能让Segoe UI Bold正常工作(我认为名字是错的)。有什么想法吗?
这里有一个例子。 (4)和(5)应该是一样的:http://jsfiddle.net/kxHQR/1/
@font-face {
font-family: 'Myname';
font-style: normal;
font-weight: 700;
src: local('Segoe UI Bold'), local('SegoeUI-bold'), local('segoeuib');
}
@font-face {
font-family: 'Myname';
font-style: normal;
font-weight: 600;
src: local('Segoe UI Semibold'), local('SegoeUI-Semibold');
}
@font-face {
font-family: 'Myname';
font-style: normal;
font-weight: 400;
src: local('Segoe UI'), local('SegoeUI');
}
@font-face {
font-family: 'Myname';
font-style: normal;
font-weight: 300;
src: local('Segoe UI Light'), local('SegoeUI-Light');
}
/* ... */
BODY {
font-family: 'Myname';
}
.boldtext {
font-family:'Segoe UI';
font-weight:700;
}
<p style='font-weight:300'>1. Text with font-weight:300. OK</h1>
<p>2. Here is normal text. OK</p>
<p style='font-weight:600'>3. Text with font-weight:600. OK</p>
<p style='font-weight:700' >4. Text with font-weight:700. It must be like (5), but it is like (3). :(</p>
<p class='boldtext'>5. Text with font-family:'Segoe UI' (no font-face) and font-weight:700; </p>
<b style="font-family: Segoe UI">Sample</b>
(不使用任何@font-face
),或尝试在文字处理器中使用Segoe UI Bold。这似乎是因为您的系统缺少或损坏了该字体。由于在我的系统上,font-family: Segoe UI Bold
无法显示它(但这种旧方法适用于Semibold和Light),而我的字体列表工具(对于IE)http://www.cs.tut.fi/~jkorpela/listfonts1.html没有列出Segoe UI Bold,所以该字体可能存在一些奇怪的问题。 - Jukka K. Korpela