css – 如何在网页中使用计算机现代字体?

我从来没有看到计算机现代字体,一个作为认为LaTeX类型设置系统,在任何网页上。

如何更改CSS以使字体实际工作?

解决方法

使用计算机现代字体在网页已经变得非常容易!只需在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镜像加载当前版本的字体,这可能很慢。这是好的测试目的,但长期来说,我建议你download这些.OTF文件到您自己的网络服务器。

相关文章

Css3如何实现鼠标移上变长特效?(图文+视频)
css3怎么实现鼠标悬停图片时缓慢变大效果?(图文+视频)
jquery如何实现点击网页回到顶部效果?(图文+视频)
css3边框阴影效果怎么做?(图文+视频)
css怎么实现圆角边框和圆形效果?(图文+视频教程)
Css3如何实现旋转移动动画特效