将 css font-family 设置为安全的手写字体

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2747589/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 21:59:43  来源:igfitidea点击:

setting css font-family to a safe handwriting font

cssfont-family

提问by dmontain

In CSS, I usually go with the usual

在 CSS 中,我通常使用通常的

font-family: Arial, Helvetica, sans-serif;

For a little change, I'm going for a font that looks like handwriting. Can some of the expert CSS folks here suggest what would be some of the safest fonts (most widely available in most browsers) that look like hardwriting

对于一点点变化,我要使用一种看起来像手写体的字体。这里的一些 CSS 专家能否建议一些看起来像硬写的最安全的字体(在大多数浏览器中最广泛使用)

回答by Alex Mcp

Similar to sans-serifthere is a generic cursivethat it a "font that resembles handwriting". This will vary by browser (as will sans-serif) but could be a good place to start.

类似于sans-serif有一个泛型cursive,它是一种“类似于手写的字体”。这将因浏览器而异(也会sans-serif),但可能是一个很好的起点。

Here is a survey of scriptfamily fonts installed per user:

以下是对script每个用户安装的系列字体的调查:

http://www.codestyle.org/css/font-family/sampler-Cursive.shtml

http://www.codestyle.org/css/font-family/sampler-Cursive.shtml

They all look significantly different from each other so you'd lose some consistency, but some are quite widely adopted.

它们看起来彼此明显不同,所以你会失去一些一致性,但有些被广泛采用。

Their main installed fonts are (FOR WINDOWS ONLY):

他们主要安装的字体是(仅适用于 WINDOWS):

Comic Sans MS     99.13%  
Monotype Corsiva    82.29%  
Bradley Hand ITC    63.02% 
Tempus Sans ITC      62.68% 
French Script MT    62.39%

回答by adjwilli

You could use one of the Google web safe fonts: http://www.google.com/webfonts/family?family=Schoolbell&subset=latin#code

您可以使用 Google 网络安全字体之一:http: //www.google.com/webfonts/family?family =Schoolbell&subset= latin#code

<link href="https://fonts.googleapis.com/css?family=Schoolbell&v1" rel="stylesheet">

h1 {
    font-family: 'Schoolbell', arial, serif; 
}

回答by Pekka

There is no handwriting font that would be reliably available in most browsers across all platforms. There are subsets like the fonts that come with Windows Vista or 7 but if you want to achieve any serious reliable coverage, it's likely that you'll have to resort to delivering the font alongside the web page - which, sadly, makes things complicated.

没有任何手写字体可以在所有平台的大多数浏览器中可靠地使用。有一些子集,例如 Windows Vista 或 7 附带的字体,但如果您想获得任何可靠的覆盖范围,您可能不得不求助于在网页旁边提供字体 - 遗憾的是,这使事情变得复杂。

Related SO questions:

相关的问题:

回答by Pekka

The only web-safe handwriting font is Comic Sans- if you want to inflict that on your users. ;)

唯一的网络安全手写字体是Comic Sans- 如果您想将其强加给您的用户。;)

For percentages, see the results of the Code Style surveyas of this month:

有关百分比,请参阅截至本月的Code Style 调查结果:

Windows  99.13%
Mac      89.94%
Linux    60.95%

The most common cursive one on Linux is URW Chancery L, but it's not cross-platform.

Linux 上最常见的草书是 URW Chancery L,但它不是跨平台的。

回答by quoo

I suppose Comic Sans or Lucida handwriting would be some of the most widely available 'handwriting' fonts, although they're not great fonts. You might be better served by looking into some of the font embeding options, either using fancy-smancy html 5 stuff: http://www.broken-links.com/2009/05/28/exciting-times-html-5-web-fonts/which won't be entirely supported, or using sIFR which is flash based: http://www.mikeindustries.com/blog/sifr, or some combination of these solutions to reach all users.

我认为 Comic Sans 或 Lucida 手写体将是一些最广泛使用的“手写体”字体,尽管它们不是很好的字体。通过查看一些字体嵌入选项,您可能会得到更好的服务,或者使用fancy-smancy html 5 的东西:http://www.broken-links.com/2009/05/28/exciting-times-html-5- web-fonts/不会被完全支持,或者使用基于 Flash 的 sIFR:http: //www.mikeindustries.com/blog/sifr,或者这些解决方案的某种组合来覆盖所有用户。

回答by danspants

Comic Sans would be the most handwritingesque font common to macs and pcs, that being said you could always embed a font in your page.

Comic Sans 将是 Mac 和 PC 中最常见的手写字体,也就是说您始终可以在页面中嵌入字体。

回答by UXdesigner

There's an alternative. If you're familiar with Javscript or Jquery. There's a very nice script called "Cufon" that does a thing called "Font Replacement". With this simple to use script, you can use ANY font you want on your website. I suggest you start by checking it's documentation, then create the cufon-js version of the font and then use it !

有一个替代方案。如果您熟悉 JavaScript 或 Jquery。有一个名为“Cufon”的非常好的脚本,它执行一种称为“字体替换”的操作。通过这个简单易用的脚本,您可以在您的网站上使用任何您想要的字体。我建议您首先检查它的文档,然后创建字体的 cufon-js 版本,然后使用它!

With code like this, you would be already doing font replacement ...check this simplicity

使用这样的代码,您已经在进行字体替换...检查这个简单性

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <script src="cufon-yui.js" type="text/javascript"></script>
        <script src="Vegur_300.font.js" type="text/javascript"></script>
        <script type="text/javascript">
            Cufon.replace('h1');
        </script>
    </head>
    <body>
        <h1>This text will be shown in Vegur.</h1>
    </body>
</html>

Please visit this website for more information: http://cufon.shoqolate.com/generate/(this is were you can generate your favorite font and make it ready to be used as a replacement on your site). Remember to include the jquery file!

请访问此网站以获取更多信息:http: //cufon.shoqolate.com/generate/(这是您可以生成自己喜欢的字体并准备好在您的网站上用作替代品的地方)。记得包含jquery文件!