How to make bootstrap headings responsive?

Viewed 4099

I'm making a bootstrap website. Everything is working smooth on all the screen sizes but the heading(h1) remains fixed size. It is too big for small screens. How can I fix the bootstrap h1 or headings in general.

3 Answers

That is my solution. Fully responsive bootstrap headings

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

@each $breakpoint in map-keys($grid-breakpoints) {
  @include media-breakpoint-up($breakpoint) {
    $infix: breakpoint-infix($breakpoint, $grid-breakpoints);

    .h1#{$infix} { font-size: $h1-font-size!important; }
    .h2#{$infix} { font-size: $h2-font-size!important; }
    .h3#{$infix} { font-size: $h3-font-size!important; }
    .h4#{$infix} { font-size: $h4-font-size!important; }
    .h5#{$infix} { font-size: $h5-font-size!important; }
    .h6#{$infix} { font-size: $h6-font-size!important; }

    .display-1#{$infix} {
      font-size: $display1-size!important;
      font-weight: $display1-weight;
      line-height: $display-line-height;
    }
    .display-2#{$infix} {
      font-size: $display2-size!important;
      font-weight: $display2-weight;
      line-height: $display-line-height;
    }
    .display-3#{$infix} {
      font-size: $display3-size!important;
      font-weight: $display3-weight;
      line-height: $display-line-height;
    }
    .display-4#{$infix} {
      font-size: $display4-size!important;
      font-weight: $display4-weight;
      line-height: $display-line-height;
    }
  }
}
Related