Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML Introduction to HTML and CSS (2016) Adding a New Web Page Write the CSS

Nikhil Meshram
Nikhil Meshram
764 Points

How can I use other fonts in the body tag?

The use of other fonts might require some other details and files to download. How do I use other fonts?

2 Answers

Zakk George
Zakk George
4,550 Points

---------FONT FAIRY HEREEEEE-----------

There are some fonts that are automatically supported by most browsers (i.e. Arial Black) However, to get special fonts into your project, I would advise taking a trip to Google Fonts.

To actually put to fonts into your document: -First- Make sure to link it in the head of your document (this only applies to external fonts) and should look something like this (Google Fonts is nice enough to write a link tag for you)

<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>

-Second- To actually change the fonts in your document, you will have to style it in CSS like this

h1 {
  font-family: 'Roboto';
}

Hope this helps!

----------GOOD LUCK----------

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hi there,

You can download fonts to your machines "fonts" folder and then display them with CSS but a better way is to use the link tag and CDN to carry the fonts such as Google Fonts,.

The body tag itself doesn't display fonts other than the default browser font. The best practice is to choose one with CSS. which you'll learn about later in the course. :)