我从未在任何网页上看到过计算机现代字体,这种字体是LaTeX类型设置系统的默认版本。
如何更改CSS,使字体实际工作?
发布于 2012-02-15 00:33:11
在网页中使用计算机现代字体变得非常容易!只需在html代码的头部分粘贴下面的CSS代码行,以便激活该字体的sans-serif版本。
<style type="text/css">
@font-face {
font-family: "Computer Modern";
src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf');
}
@font-face {
font-family: "Computer Modern";
src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunsx.otf');
font-weight: bold;
}
@font-face {
font-family: "Computer Modern";
src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunsi.otf');
font-style: italic, oblique;
}
@font-face {
font-family: "Computer Modern";
src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunbxo.otf');
font-weight: bold;
font-style: italic, oblique;
}
body {
font-family: "Computer Modern", sans-serif;
}
</style>请注意,这里的解决方案使浏览器从CTAN镜像加载当前版本的字体,这可能非常慢。对于测试目的来说,这是可以的,但从长远来看,我建议您将这些下载文件发送到您自己的the服务器。
发布于 2015-10-07 22:28:12
您只需将https://cdn.rawgit.com/dreampulse/computer-modern-web-font/master/fonts.css css-样式表插入到html头中即可。如下所示:
<head>
<!-- ... -->
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/dreampulse/computer-modern-web-font/master/fonts.css">
<style>
body {
font-family: "Computer Modern Sans", sans-serif;
}
</style>
</head>您可以使用的字体生产网站与任何数量的流量。文件通过MaxCDN的超快全球CDN提供。没有交通限制或节流。
发布于 2014-11-08 13:23:14
现在,您可以从这个网页下载所需的一切(字体文件和css):
http://checkmyworking.com/cm-web-fonts/
然后,您只需将相应的css文件添加到html文件的标题部分,如下所示:
<head>
<meta charset="UTF-8" />
<title>Test</title>
<!-- Computer Modern Serif-->
<link rel="stylesheet" href="fonts/Serif/cmun-serif.css"></link>
...
</head>https://stackoverflow.com/questions/6476351
复制相似问题