简体   繁体   English

CSS - 为什么font-style:italic不适用于font-family:Helvetica,Arial,sans-serif?

[英]CSS - Why is font-style: italic not applied for font-family: Helvetica, Arial, sans-serif?

For some reason, this rule is applied in Chrome on Mac, but not on Windows. 出于某种原因,此规则适用于Mac上的Chrome,但不适用于Windows。 The arrows at the bottom of the page should be italicized, but it only works on Mac. 页面底部的箭头应为斜体,但仅适用于Mac。

You can see the example here: http://jansensan.net/clients/float4/allianz-global-assistance/true-stories.html 你可以在这里看到这个例子: http//jansensan.net/clients/float4/allianz-global-assistance/true-stories.html

You can see the CSS here: http://jansensan.net/clients/float4/allianz-global-assistance/assets/css/main.css 你可以在这里看到CSS: http//jansensan.net/clients/float4/allianz-global-assistance/assets/css/main.css

Look for the .buttonLabel class. 寻找.buttonLabel类。

Just before you mention that it may work in IE or Firefox, these browsers are irrelevant to this project. 就在你提到它可能在IE或Firefox中运行之前,这些浏览器与这个项目无关。 The HTML output is into a custom Webkit integration that behaves identically to Chrome. HTML输出进入自定义Webkit集成,其行为与Chrome相同。

Is there something obvious that I overlooked? 我忽略了一些明显的东西吗? Thanks for any help! 谢谢你的帮助!

The reason appears to be that you are trying to italicize a character that has no italic version, ie it looks the same in an italic font as in a normal (upright) font. 原因似乎是你试图使一个没有斜体版本的字符斜体,即它看起来像斜体字体一样,与普通(直立)字体相同。 This is normal for special characters; 这对于特殊字符来说是正常的; using italic basically means using specially designed glyphs for letters and maybe for some other characters. 使用斜体基本上意味着使用专门设计的字母字形和其他一些字符。

The relevant markup here seems to be 这里的相关标记似乎是

<div class="buttonLabel label">&lt;</div>

and the relevant CSS code 和相关的CSS代码

.buttonLabel
{
font-family: Verdana, sans-serif;
font-style: italic;
}

(Contrary to the question heading, I can't find any reference to Helvetica or Arial in the CSS code. And I can't find any arrows, just LESS THAN and GREATER THAN characters.) (与问题标题相反,我在CSS代码中找不到任何对Helvetica或Arial的引用。我找不到任何箭头,只有少于几个字符。)

In Verdana, the italic glyph for “<” is the same as the normal glyph. 在Verdana中,“<”的斜体字形与普通字形相同。 Ditto in Arial. 在Arial中也是如此。 In some other fonts, it might look different, though this should be regarded as a typographic flaw. 在其他一些字体中,它可能看起来不同,但这应该被视为印刷缺陷。 Some fonts, such as Arial Unicode MS, do not have an italic version at all. 某些字体(如Arial Unicode MS)根本没有斜体版本。 Some browsers and other programs may (erroneously) apply artificial “italic” to such fonts, by algorithmically slanting normal glyphs. 某些浏览器和其他程序可能(错误地)通过算法倾斜正常字形将这些字体应用于人工“斜体”。

The solution depends on what you are after. 解决方案取决于您的目标。 I cannot see a reason to try to italicize “<” or “>”, but if you wish to get some distorted slanted versions of such characters, using images is the practical solution. 我看不出尝试斜体“<”或“>”的理由,但是如果你想得到这些字符的一些扭曲的倾斜版本,使用图像是实用的解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我设置 font-family: 'Helvetica', 'Helvetica Neue', 'Arial', sans-serif 时,为什么我的网站上呈现的字体是 Arial; - Why is the rendered font on my website Arial when I have set font-family: 'Helvetica', 'Helvetica Neue', 'Arial', sans-serif; 验证错误:值错误:font-family&#39;Neue&#39;不是一个字体系列值:Helvetica&#39;Neue&#39;,Helvetica,Arial,sans-serif - Validation Error: Value Error : font-family 'Neue' is not a font-family value : Helvetica 'Neue',Helvetica,Arial,sans-serif CSS:Helvetica是Mac上的默认&#39;sans-serif&#39;字体,Arial是Windows上的默认sans-serif字体吗? - CSS: Is Helvetica the default 'sans-serif' font on Mac and Arial the default sans-serif font on Windows? Android Sans-Serif字体 - Android sans-serif font 字体系列在 Chrome 中自动更改为“undefined,sans-serif!important” - Font family automatically changes to "undefined,sans-serif!important" in Chrome CSS - 使用sans-serif字体模仿等宽字体 - CSS - Make sans-serif font imitate monospace font font-family:“Shojumaru”,草书,Arial,serif; ,在IE上无法正确显示 - font-family: “Shojumaru”,cursive,Arial,serif; , is not displaying correctly on IE 使用jquery / css精确地垂直对齐sans-serif字体 - Vertically align sans-serif font precisely using jquery/css 带引号的字体“ sans-serif”在CSS中无法正常工作 - Quoted font 'sans-serif' not working properly in CSS WebFont @ font-face定义serif / sans-serif / monospace - WebFont @font-face define serif/sans-serif/monospace
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM