How do I implement responsive typography with Bootstrap 4?

Not a complete answer, but a good starting point is to enable responsive font sizes in v.4.5

$enable-responsive-font-sizes: true;
@import "../../../node_modules/bootstrap/scss/bootstrap";

As of Bootstrap 4.3.1, there is now RFS (Responsive Font Sizing)! However, as explained in the docs, you must enable it using the $enable-responsive-font-sizes SASS variable.

RFS Demo: https://www.codeply.com/go/jr8RbeNf2M


Before Bootstrap 4.3.1, you'd can implement responsive text using SASS. However you need to specify the desired appropriate selector(s) for text that you want to resize...

@import "bootstrap/functions";
@import "bootstrap/variables";
@import "bootstrap/mixins";

html {
  font-size: 1rem;
}

@include media-breakpoint-up(sm) {
  html {
    font-size: 1.1rem;
  }
}

@include media-breakpoint-up(md) {
  html {
    font-size: 1.2rem;
  }
}

@include media-breakpoint-up(lg) {
  html {
    font-size: 1.3rem;
  }
}

@import "bootstrap"; 

Demo: https://www.codeply.com/go/5pZDWAvenE

This could also be done using CSS only (no SASS):

Demo: https://www.codeply.com/go/E1MVXqp21D


I think the easiest way is to use @media Queries. Suppose you want to change the font size responsively for a content with class "class-name" or even for entire html tag, just add your media queries to end of your css file or any place inside it.

Sample code:

/*
####################################################
M E D I A  Q U E R I E S
####################################################
*/

/*
::::::::::::::::::::::::::::::::::::::::::::::::::::
Bootstrap 4 breakpoints
*/

  /* Small devices (landscape phones, 544px and up) */
  @media (min-width: 544px) {  
    .class-name {font-size: 16px;}
  }

  /* Medium devices (tablets, 768px and up) */
  @media (min-width: 768px) {  
    .class-name {font-size: 30px;}
  }

  /* Large devices (desktops, 992px and up) */
  @media (min-width: 992px) { 
    .class-name {font-size: 40px;}
  }

  /* Extra large devices (large desktops, 1200px and up) */
  @media (min-width: 1200px) {  
    .class-name {font-size: 48px;}
  }

more information can be found here


This is a Sass feature.

To have access to the media-breakpoint mixins and the size variables, you need to:

  1. add a custom.scss file
  2. @import "node_modules/bootstrap/scss/bootstrap";
  3. and setup a Sass compiler

https://getbootstrap.com/docs/4.0/getting-started/theming/