关于 font-family:san-serif

前些天看到阿捷提到xhtml验证的问题,说明字体最后必须以sans-serif(无衬角字体,简单地理解就是中文的黑体,文字笔划末端结束嘎然而止,而不是拐来拐去)这样的字体类别作为结束。几天又看到这个,这样的字体类型名 不能加引号。前些天,我遇到过这个问题,当时也没仔细看,原来是加引号的问题。

以下为引用内容:
CSS的font-family 
通过CSS Validator发现自己写的css中一个错误,就是generic font family是作为关键字的,因此不能用引号。
这几个关键字是 serif, sans-serif, cursive, fantasy, monospace
下面是一个示例:
body {
 font-family: "Geneva", "Arial", "Helvetica", sans-serif;
}

下面引自 http://www.w3.org/TR/REC-CSS2/fonts.html#generic-font-families
指出了一些常用的字体属于哪一类。



原文还提到了cursive  fantasy  monospace这三个css字体分类,这我倒是第一次听说。
以下为引用内容:
Generic font families
Generic font families are a fallback mechanism, a means of preserving some of the style sheet author's intent in the worst case when none of the specified fonts can be selected. For optimum typographic control, particular named fonts should be used in style sheets. 

All five generic font families are defined to exist in all CSS implementations (they need not necessarily map to five distinct actual fonts). User agents should provide reasonable default choices for the generic font families, which express the characteristics of each family as well as possible within the limits allowed by the underlying technology. 

User agents are encouraged to allow users to select alternative choices for the generic fonts. 

serif
Glyphs of serif fonts, as the term is used in CSS, have finishing strokes, flared or tapering ends, or have actual serifed endings (including slab serifs). Serif fonts are typically proportionately-spaced. They often display a greater variation between thick and thin strokes than fonts from the 'sans-serif' generic font family. CSS uses the term 'serif' to apply to a font for any script, although other names may be more familiar for particular scripts, such as Mincho (Japanese), Sung or Song (Chinese), Totum or Kodig (Korean). Any font that is so described may be used to represent the generic 'serif' family. 

Examples of fonts that fit this description include:

Latin fonts  Times New Roman, Bodoni, Garamond, Minion Web, ITC Stone Serif, MS Georgia, Bitstream Cyberbit  
Greek fonts  Bitstream Cyberbit  
Cyrillic fonts  Adobe Minion Cyrillic, Excelcior Cyrillic Upright, Monotype Albion 70, Bitstream Cyberbit, ER Bukinst  
Hebrew fonts  New Peninim, Raanana, Bitstream Cyberbit  
Japanese fonts  Ryumin Light-KL, Kyokasho ICA, Futo Min A101  
Arabic fonts  Bitstream Cyberbit  
Cherokee fonts  Lo Cicero Cherokee  

sans-serif
Glyphs in sans-serif fonts, as the term is used in CSS, have stroke endings that are plain -- without any flaring, cross stroke, or other ornamentation. Sans-serif fonts are typically proportionately-spaced. They often have little variation between thick and thin strokes, compared to fonts from the 'serif' family. CSS uses the term 'sans-serif' to apply to a font for any script, although other names may be more familiar for particular scripts, such as Gothic (Japanese), Kai (Chinese), or Pathang (Korean). Any font that is so described may be used to represent the generic 'sans-serif' family. 

Examples of fonts that fit this description include:

Latin fonts  MS Trebuchet, ITC Avant Garde Gothic, MS Arial, MS Verdana, Univers, Futura, ITC Stone Sans, Gill Sans, Akzidenz Grotesk, Helvetica  
Greek fonts  Attika, Typiko New Era, MS Tahoma, Monotype Gill Sans 571, Helvetica Greek  
Cyrillic fonts  Helvetica Cyrillic, ER Univers, Lucida Sans Unicode, Bastion  
Hebrew fonts  Arial Hebrew, MS Tahoma  
Japanese fonts  Shin Go, Heisei Kaku Gothic W5  
Arabic fonts  MS Tahoma  

cursive
Glyphs in cursive fonts, as the term is used in CSS, generally have either joining strokes or other cursive characteristics beyond those of italic typefaces. The glyphs are partially or completely connected, and the result looks more like handwritten pen or brush writing than printed letterwork. Fonts for some scripts, such as Arabic, are almost always cursive. CSS uses the term 'cursive' to apply to a font for any script, although other names such as Chancery, Brush, Swing and Script are also used in font names. 

Examples of fonts that fit this description include:

Latin fonts  Caflisch Script, Adobe Poetica, Sanvito, Ex Ponto, Snell Roundhand, Zapf-Chancery  
Cyrillic fonts  ER Architekt  
Hebrew fonts  Corsiva  
Arabic fonts  DecoType Naskh, Monotype Urdu 507  

fantasy
Fantasy fonts, as used in CSS, are primarily decorative while still containing representations of characters (as opposed to Pi or Picture fonts, which do not represent characters). Examples include:

Latin fonts  Alpha Geometrique, Critter, Cottonwood, FB Reactor, Studz  

monospace
The sole criterion of a monospace font is that all glyphs have the same fixed width. (This can make some scripts, such as Arabic, look most peculiar.) The effect is similar to a manual typewriter, and is often used to set samples of computer code. 

Examples of fonts which fit this description include: Latin fonts  Courier, MS Courier New, Prestige, Everson Mono  
Greek Fonts  MS Courier New, Everson Mono  
Cyrillic fonts  ER Kurier, Everson Mono  
Japanese fonts  Osaka Monospaced  
Cherokee fonts  Everson Mono 


原文地址:
http://www.donews.net/wordy/archive/2004/12/05/193748.aspx
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
`font-family: Arial, sans-serif;` 是一个常用的 属性,用于设置字体的样式。让我来解释一下这个属性的含: - `Arial` 是字体的名称,指定使用 Arial 字体。Arial 是一常见的无衬线字体,广泛被支持和使用。 - `sans-serif` 是一个通用的字体系列名称,表示使用无衬线字体。如果 Arial 字体可用,浏览器会尝试使用其他无衬线字体替代。 这样的设置是为了提供一个备选方案,以确保即使用户的计算机上没有安装 Arial 字体,页面上的文本仍然能够以合适的字体显示。当浏览器无法加载指定的字体时,它会尝试使用默认的无衬线字体来显示文本。 这个设置通常用于确保跨不同的操作系统和设备上显示一致的字体样式。Arial 是一种常见的字体,在大多数操作系统和设备上都有较好的兼容性。而 sans-serif 作为备选项,是一种通用的无衬线字体系列,可以在大多数情况下提供一个合适的替代字体。 示例用法: ```css body { font-family: Arial, sans-serif; } ``` 在上述示例中,我们将 `font-family` 属性应用于 `body` 元素,以确保整个页面上的文本都使用 Arial 或者备选的无衬线字体来显示。你可以将这个属性应用于任何需要设置字体样式的元素上。 请注意,`Arial, sans-serif` 只是一个示例,在实际使用中,你可以根据需要选择其他字体或字体系列来设置 `font-family` 属性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值