如何将此代码中的字体更改为merriweather? [英] How do I change the font in this code to merriweather?

查看:83
本文介绍了如何将此代码中的字体更改为merriweather?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站上添加当天的Brainyquote自然报价:Javascript Feed,以便它可以每天自动更改,但我不知道如何更改字体。这是我必须复制/粘贴到我的网页的代码:



I wanted to add the Brainyquote Nature Quote Of The Day: Javascript Feed on my website, so that it could automatically change by itself every day, but I didn't know how to change the font. This is the code that I had to copy/paste into my webpage:

<script type="text/javascript" src="https://www.brainyquote.com/link/quotena.js"></script>
<small><a href="https://www.brainyquote.com/quotes/topics/topic_nature.html" target="_blank" rel="nofollow">more Nature Quotes</a></small>





//输出今天的报价:



每日自然报价

阅读性质;大自然是真理的朋友。

Edward Young

更多自然行情



我有什么尝试过:



我想将字体更改为Merriweather,所以我尝试使用谷歌字体,并以标准方式插入,但它没有'改变字体。那么我应该把这个链接放在哪里?



//Outputs the quote of today:

Nature Quote of the Day
Read nature; nature is a friend to truth.
Edward Young
more Nature Quotes

What I have tried:

I wanted to change the font to Merriweather, so I tried using google fonts, and inserting it in the standard way,but it didn't change the font. So where am I supposed to put this link?

推荐答案

你好,



你需要申请使用CSS加载到页面日期区域引用的字体:



有不同的应用CSS的方法,下面是一种方式,以粗体文本突出显示:



Hello,

You need to apply the font you loaded to the quote of the day area of the page using CSS:

There are different ways of applying CSS, below is one way, highlighted in bold text:

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

<div style="font-family: 'Merriweather', serif;">
<script type="text/javascript" src="https://www.brainyquote.com/link/quotena.js"></script>
<small><a href="https://www.brainyquote.com/quotes/topics/topic_nature.html" target="_blank" rel="nofollow">more Nature Quotes</a></small>
</div>





这封以HTML<中的当天引用; DIV>标记,然后将Merriweather字体应用于其内容。



This encloses the quote of the day in a HTML <div> tag and then applies the Merriweather font to its content.


是样式属性很重要。该链接只加载字体,以便可以在页面上使用。然后你必须应用这个字体。



请看下面的例子:



开始使用Google字体API
Yes the style attribute is important. The link just loads the font so it can be used on the page. You have to then apply the font.

Please see the following which gives a better example:

Get Started with the Google Fonts API


这篇关于如何将此代码中的字体更改为merriweather?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆