简体   繁体   English

如何将bootstrap.css字体系列HTML更改为我自己下载的字体

[英]How to change bootstrap.css font-family HTML to my own downloaded font

I've tried to find how to do that, at least this link almost got me. 我试图找到如何做到这一点,至少这个链接几乎让我。 but she/he is using link to change the font. 但她/他正在使用链接来更改字体。

but I've my own downloaded font using font converter (.eot .otf .svg .ttf .woff .woff2) 但我使用字体转换器 (.eot .otf .svg .ttf .woff .woff2)自己下载的字体

and I have style.css like below: 我有如下的style.css

/* font converted using font-converter.net. thank you! */
@font-face {
  font-family: "CataneoBT-Regular";

  src: url("./fonts/07323Cataneo.svg") format("svg"), /* Legacy iOS */
    url("./fonts/07323Cataneo.ttf") format("truetype"), /* Safari, Android, iOS */
    url("./fonts/07323Cataneo.woff") format("woff"), /* Modern Browsers */
    url("./fonts/07323Cataneo.woff2") format("woff2"); /* Modern Browsers */
  font-weight: normal;
  font-style: normal;
}

This is piece of code of my bootstrap.css html: 这是我的bootstrap.css html的一段代码:

html {
  font-family: sans-serif;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
}

The most similar code of my bootstrap is: 我的bootstrap最相似的代码是:

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url('../fonts/glyphicons-halflings-regular.eot');
  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix')
  format('embedded-opentype'),
  url('../fonts/glyphicons-halflings-regular.woff2')
  format('woff2'),
  url('../fonts/glyphicons-halflings-regular.woff')
  format('woff'),
  url('../fonts/glyphicons-halflings-regular.ttf')
  format('truetype'),
  url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular')
  format('svg');
}
.glyphicon {
  position: relative;
  top: 1px;
  display: inline-block;
  font-family: 'Glyphicons Halflings';
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

but as far as I know, this code just to displaying some icon 但据我所知,这段代码只是为了显示一些图标

I don't know how to change that code to displaying my own font 我不知道如何将该代码更改为显示我自己的字体

Just use following CSS to your CSS file which should include after bootstrap .. 只需将以下CSS用于CSS文件,该文件应包含在bootstrap之后。

@font-face {
    font-family: <Your-font>;
    src: url(<your-font-path>);
}
html, body {
    font-family: <Your-font>, sans-serif; /*Specify your font name here*/
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

In style.css file u need to link the font-family, give your font path in src 在style.css文件中你需要链接font-family,在src中给出你的字体路径

@font-face {
 font-family: 'sans-serif';
 font-weight: normal;
 font-style: normal;
 src: url('../fonts/sans-serif.eot') format('embedded-opentype'), url('../fonts/sans-serif.woff') format('woff'), url('../fonts/sans-serif.ttf') format('truetype'), url('../fonts/sans-serif.otf') format('opentype'), url('../fonts/sans-serif.svg#sans-serif') format('svg');
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM