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

CSS Bootstrap 4 Basics (Retired) Responsive Layouts with the Bootstrap Grid Styling Content

Bootstrap 4 font type

Bootstrap 4 and Bootstrap 3 have (slightly different) font types. Is there a way to switch the fonts in Boostrap back to the old one?

1 Answer

Jacob Tollette
Jacob Tollette
27,884 Points

Well, according to BS4 documentation on typography , they chose to use a native font stack that selects the "best font-family for each OS and device." That said, there are several ways to override the font stack, it just depends on how you're using the framework.

If you're using a compiled (dist) version (like from the CDN or a downloaded .css file), you'll need to override all the font families manually. For example:

body {
  font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}

That would override the font for all child elements of the <body> that aren't explicitly set (like inputs and <pre>).

I snagged that stack from BS3. If you're missing fonts, you'll need to include them either locally or through a CDN (like google fonts).

If you're using Sass, change the value of $font-family-base in _variables.scss and compile.

Here's a refresher on Web Fonts if you need it.