Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,864 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.