Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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>


//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?
Posted
Updated 9-Nov-17 9:16am

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>


This encloses the quote of the day in a HTML <div> tag and then applies the Merriweather font to its content.
 
Share this answer
 
Comments
Member 13502831 9-Nov-17 4:36am    
but is the style tag important here? I mean aren't the div and link tag enough? Thanks :)
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900