I\'m building a responsive web app with Bootstrap 4. I want the font size of all text to be reduced on mobile devices compared to desktop, so I added the following to my bas
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