2013-06-03 91 views
8

我在我的网站中使用了Segoe UI Light字体。Segoe UI Light字体在Google Chrome中无法正常显示

使用的CSS如下。

.divMainHeader 
{ 
font-family:Segoe UI; 
font-size:28pt; 
font-weight:lighter; 
width:100% 
} 

但谷歌浏览器不能正确呈现此字体。我在Chrome中获得了Segoe UI Light的粗体字体。

The Image。 The Screen Shots joined of different browsers.

我使用的浏览器版本。

Internet Explorer中:9

是Mozilla Firefox:21

谷歌浏览器:27

+0

这有帮助吗? http://stackoverflow.com/questions/2705791/how-do-i-get-font-weight-lighter-to-work-in-google-chrome –

+0

@ralph,没有工作:( –

回答

1

可能是由于多种原因:

  1. 也许你正在使用错误的字体格式。 Chrome支持SVG,WOFF,TTF/OFT。
  2. 迈出定义字体重量一种错误的做法,从而导致浏览器解释font-weight属性错误地

样品:http://pastebin.com/FiGvAfTk

你正确地定义您的字体?

+0

我使用TTF类型,我尝试了不同的方法来分配字体重量,没有什么效果。 –

+0

你能发布你的代码吗? –

+0

我使用的是我在问题中使用过的相同代码因为这个问题,我切换到roboto浓缩,它是在所有的浏览器中都能正常工作 –

1

有趣......我在几乎相反的问题...我能得到的Segoe UI光在Chrome和IE 10正确地呈现,而不是在FF 21

another post some time back,有人建议使用类似于微软利用在其网站上的东西...

h1, h2, h3, h4, h5, h6, h7 { 
    font-family: "wf_SegoeUILight","wf_SegoeUI","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe","Segoe WP","Tahoma","Verdana","Arial","sans-serif"; 
    font-weight: 300; 
} 

对于不履行字体重量+中的Segoe UI字体浏览器,指定的Segoe UI光第一似乎保证它呈现重量更轻的字体。

但是,在FF 21中,无论我尝试什么,我仍然看到正常的Segoe UI字体。 Firebug表示它正在从列表中选择Segoe UI字体。

1

我自己也有类似的问题,浏览器只渲染标准的Segoe UI而不是较轻的版本。如果您将字体族更改为Segoe UI Light,则应该按照您的要求进行操作。

请参阅下面的修改后的代码:

.divMainHeader { 
    font-family:"Segoe UI Light"; 
    font-size:28pt; 
    font-weight:100; 
    width:100% 
} 
0
@font-face { 
    font-family: 'Myfont'; 
    font-style: normal; 
    font-weight: 200; 
    src: local('Segoe UI Light'), local('SegoeUI-Light'); 

} 

body{ 
    font-family: 'Myfont'; 
} 

此代码固定我的问题像你

3

它很难获得在Firefox这个工作。字体重量300在所有版本中都不会工作很少。以下代码适用于我,并与所有浏览器兼容。

font-family: "Segoe UI Light","Segoe UI"; 
font-weight: 300; 

Here 这是从HTML5解决方案,但它可能会帮助你也一样,它也是在Visual Studio ... 悬停在CSS字体重量选项会告诉你的话重量(光,半等) 100:薄 200:额外光(超轻) 300:光 400:正常 500:中等 600:半粗体(黛咪粗体) 700:粗体 800:额外粗体 希望它有帮助。

请按照以下选项添加字体重量,而不是使用半角或半角。只需将字体重量组合使用'segoe ui'。

@font-face { 
    font-family: "Segoe UI"; 
    font-weight: 200; 
    src: local("Segoe UI Light"); 
} 
@font-face { 
    font-family: "Segoe UI"; 
    font-weight: 300; 
    src: local("Segoe UI Semilight"); 
} 
@font-face { 
    font-family: "Segoe UI"; 
    font-weight: 400; 
    src: local("Segoe UI"); 
} 
@font-face { 
    font-family: "Segoe UI"; 
    font-weight: 600; 
    src: local("Segoe UI Semibold"); 
} 
@font-face { 
    font-family: "Segoe UI"; 
    font-weight: 700; 
    src: local("Segoe UI Bold"); 
} 
@font-face { 
    font-family: "Segoe UI"; 
    font-style: italic; 
    font-weight: 400; 
    src: local("Segoe UI Italic"); 
} 
@font-face { 
    font-family: "Segoe UI"; 
    font-style: italic; 
    font-weight: 700; 
    src: local("Segoe UI Bold Italic"); 
}