Giter Site home page Giter Site logo

自定义样式中设置字体无效 about md HOT 5 CLOSED

Yeijon avatar Yeijon commented on June 11, 2024
自定义样式中设置字体无效

from md.

Comments (5)

YangFong avatar YangFong commented on June 11, 2024
  1. 语法错误,font 不能只填一个字体,还需要补充其他参数。此处推荐修改为 font-family
  2. 对于自定义字体,需要导入对应的资源才可生效。

from md.

Yeijon avatar Yeijon commented on June 11, 2024
  1. 语法错误,font 不能只填一个字体,还需要补充其他参数。此处推荐修改为 font-family
  2. 对于自定义字体,需要导入对应的资源才可生效。

感谢回复!
我尝试修改为

/* 行内代码样式 */
codespan {
  font-family: Roboto, monospace;
}

但是仍旧没有效果,可能是没有对应资源?我在这方面是个小白,请教如何导入对应字体

from md.

YangFong avatar YangFong commented on June 11, 2024
  1. 语法错误,font 不能只填一个字体,还需要补充其他参数。此处推荐修改为 font-family
  2. 对于自定义字体,需要导入对应的资源才可生效。

感谢回复! 我尝试修改为

/* 行内代码样式 */
codespan {
  font-family: Roboto, monospace;
}

但是仍旧没有效果,可能是没有对应资源?我在这方面是个小白,请教如何导入对应字体

你可以先试试加入下面这段代码:

@font-face {
  font-family: "Bitstream Vera Serif Bold";
  src: url("https://mdn.github.io/css-examples/web-fonts/VeraSeBd.ttf");
}

h1 { 
 font-family: 'Bitstream Vera Serif Bold', serif; 
}

使用参考:

from md.

YangFong avatar YangFong commented on June 11, 2024

上面的方式是远程加载字体,而如何使用本地字体,在不改源码的前提下,这或许是个问题。

我想想有什么好的方式去实现。

from md.

Yeijon avatar Yeijon commented on June 11, 2024

上面的方式是远程加载字体,而如何使用本地字体,在不改源码的前提下,这或许是个问题。

我想想有什么好的方式去实现。

感谢回复,后来我将文章发布,发现虽然在浏览器中呈现的是

复制粘贴在微信公众号并发布后,行内代码看起来比较像monospace形式

from md.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.