Skip to content

Commit

Permalink
Responsive font size implementation (#23816)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnCuppens committed Feb 7, 2019
1 parent d250567 commit 51375ab
Show file tree
Hide file tree
Showing 35 changed files with 324 additions and 124 deletions.
2 changes: 1 addition & 1 deletion scss/_badge.scss
Expand Up @@ -6,7 +6,7 @@
.badge {
display: inline-block;
padding: $badge-padding-y $badge-padding-x;
font-size: $badge-font-size;
@include font-size($badge-font-size);
font-weight: $badge-font-weight;
line-height: 1;
text-align: center;
Expand Down
2 changes: 1 addition & 1 deletion scss/_close.scss
@@ -1,6 +1,6 @@
.close {
float: right;
font-size: $close-font-size;
@include font-size($close-font-size);
font-weight: $close-font-weight;
line-height: 1;
color: $close-color;
Expand Down
10 changes: 5 additions & 5 deletions scss/_code.scss
@@ -1,6 +1,6 @@
// Inline code
code {
font-size: $code-font-size;
@include font-size($code-font-size);
color: $code-color;
word-break: break-word;

Expand All @@ -13,15 +13,15 @@ code {
// User input typically entered via keyboard
kbd {
padding: $kbd-padding-y $kbd-padding-x;
font-size: $kbd-font-size;
@include font-size($kbd-font-size);
color: $kbd-color;
background-color: $kbd-bg;
@include border-radius($border-radius-sm);
@include box-shadow($kbd-box-shadow);

kbd {
padding: 0;
font-size: 100%;
@include font-size(100%);
font-weight: $nested-kbd-font-weight;
@include box-shadow(none);
}
Expand All @@ -30,12 +30,12 @@ kbd {
// Blocks of code
pre {
display: block;
font-size: $code-font-size;
@include font-size($code-font-size);
color: $pre-color;

// Account for some code outputs that place code tags in pre tags
code {
font-size: inherit;
@include font-size(inherit);
color: inherit;
word-break: normal;
}
Expand Down
6 changes: 3 additions & 3 deletions scss/_custom-forms.scss
Expand Up @@ -215,7 +215,7 @@
height: $custom-select-height;
padding: $custom-select-padding-y ($custom-select-padding-x + $custom-select-indicator-padding) $custom-select-padding-y $custom-select-padding-x;
font-family: $custom-select-font-family;
font-size: $custom-select-font-size;
@include font-size($custom-select-font-size);
font-weight: $custom-select-font-weight;
line-height: $custom-select-line-height;
color: $custom-select-color;
Expand Down Expand Up @@ -270,15 +270,15 @@
padding-top: $custom-select-padding-y-sm;
padding-bottom: $custom-select-padding-y-sm;
padding-left: $custom-select-padding-x-sm;
font-size: $custom-select-font-size-sm;
@include font-size($custom-select-font-size-sm);
}

.custom-select-lg {
height: $custom-select-height-lg;
padding-top: $custom-select-padding-y-lg;
padding-bottom: $custom-select-padding-y-lg;
padding-left: $custom-select-padding-x-lg;
font-size: $custom-select-font-size-lg;
@include font-size($custom-select-font-size-lg);
}


Expand Down
4 changes: 2 additions & 2 deletions scss/_dropdown.scss
Expand Up @@ -24,7 +24,7 @@
min-width: $dropdown-min-width;
padding: $dropdown-padding-y 0;
margin: $dropdown-spacer 0 0; // override default ul
font-size: $dropdown-font-size;
@include font-size($dropdown-font-size);
color: $dropdown-color;
text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer)
list-style: none;
Expand Down Expand Up @@ -178,7 +178,7 @@
display: block;
padding: $dropdown-padding-y $dropdown-item-padding-x;
margin-bottom: 0; // for use with heading elements
font-size: $font-size-sm;
@include font-size($font-size-sm);
color: $dropdown-header-color;
white-space: nowrap; // as with > li > a
}
Expand Down
12 changes: 6 additions & 6 deletions scss/_forms.scss
Expand Up @@ -10,7 +10,7 @@
height: $input-height;
padding: $input-padding-y $input-padding-x;
font-family: $input-font-family;
font-size: $input-font-size;
@include font-size($input-font-size);
font-weight: $input-font-weight;
line-height: $input-line-height;
color: $input-color;
Expand Down Expand Up @@ -83,21 +83,21 @@ select.form-control {
padding-top: calc(#{$input-padding-y} + #{$input-border-width});
padding-bottom: calc(#{$input-padding-y} + #{$input-border-width});
margin-bottom: 0; // Override the `<label>/<legend>` default
font-size: inherit; // Override the `<legend>` default
@include font-size(inherit); // Override the `<legend>` default
line-height: $input-line-height;
}

.col-form-label-lg {
padding-top: calc(#{$input-padding-y-lg} + #{$input-border-width});
padding-bottom: calc(#{$input-padding-y-lg} + #{$input-border-width});
font-size: $input-font-size-lg;
@include font-size($input-font-size-lg);
line-height: $input-line-height-lg;
}

.col-form-label-sm {
padding-top: calc(#{$input-padding-y-sm} + #{$input-border-width});
padding-bottom: calc(#{$input-padding-y-sm} + #{$input-border-width});
font-size: $input-font-size-sm;
@include font-size($input-font-size-sm);
line-height: $input-line-height-sm;
}

Expand Down Expand Up @@ -137,15 +137,15 @@ select.form-control {
.form-control-sm {
height: $input-height-sm;
padding: $input-padding-y-sm $input-padding-x-sm;
font-size: $input-font-size-sm;
@include font-size($input-font-size-sm);
line-height: $input-line-height-sm;
@include border-radius($input-border-radius-sm);
}

.form-control-lg {
height: $input-height-lg;
padding: $input-padding-y-lg $input-padding-x-lg;
font-size: $input-font-size-lg;
@include font-size($input-font-size-lg);
line-height: $input-line-height-lg;
@include border-radius($input-border-radius-lg);
}
Expand Down
2 changes: 1 addition & 1 deletion scss/_images.scss
Expand Up @@ -37,6 +37,6 @@
}

.figure-caption {
font-size: $figure-caption-font-size;
@include font-size($figure-caption-font-size);
color: $figure-caption-color;
}
6 changes: 3 additions & 3 deletions scss/_input-group.scss
Expand Up @@ -104,7 +104,7 @@
align-items: center;
padding: $input-padding-y $input-padding-x;
margin-bottom: 0; // Allow use of <label> elements by overriding our default margin-bottom
font-size: $input-font-size; // Match inputs
@include font-size($input-font-size); // Match inputs
font-weight: $font-weight-normal;
line-height: $input-line-height;
color: $input-group-addon-color;
Expand Down Expand Up @@ -139,7 +139,7 @@
.input-group-lg > .input-group-prepend > .btn,
.input-group-lg > .input-group-append > .btn {
padding: $input-padding-y-lg $input-padding-x-lg;
font-size: $input-font-size-lg;
@include font-size($input-font-size-lg);
line-height: $input-line-height-lg;
@include border-radius($input-border-radius-lg);
}
Expand All @@ -156,7 +156,7 @@
.input-group-sm > .input-group-prepend > .btn,
.input-group-sm > .input-group-append > .btn {
padding: $input-padding-y-sm $input-padding-x-sm;
font-size: $input-font-size-sm;
@include font-size($input-font-size-sm);
line-height: $input-line-height-sm;
@include border-radius($input-border-radius-sm);
}
Expand Down
3 changes: 3 additions & 0 deletions scss/_mixins.scss
Expand Up @@ -2,6 +2,9 @@
//
// Used in conjunction with global variables to enable certain theme features.

// Vendor
@import "vendor/rfs";

// Deprecate
@import "mixins/deprecate";

Expand Down
4 changes: 2 additions & 2 deletions scss/_navbar.scss
Expand Up @@ -44,7 +44,7 @@
padding-top: $navbar-brand-padding-y;
padding-bottom: $navbar-brand-padding-y;
margin-right: $navbar-padding-x;
font-size: $navbar-brand-font-size;
@include font-size($navbar-brand-font-size);
line-height: inherit;
white-space: nowrap;

Expand Down Expand Up @@ -107,7 +107,7 @@
// Button for toggling the navbar when in its collapsed state
.navbar-toggler {
padding: $navbar-toggler-padding-y $navbar-toggler-padding-x;
font-size: $navbar-toggler-font-size;
@include font-size($navbar-toggler-font-size);
line-height: 1;
background-color: transparent; // remove default button style
border: $border-width solid transparent; // remove default button style
Expand Down
4 changes: 2 additions & 2 deletions scss/_popover.scss
Expand Up @@ -8,7 +8,7 @@
// Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.
// So reset our font and text properties to avoid inheriting weird values.
@include reset-text();
font-size: $popover-font-size;
@include font-size($popover-font-size);
// Allow breaking very long words so they don't overflow the popover's bounds
word-wrap: break-word;
background-color: $popover-bg;
Expand Down Expand Up @@ -153,7 +153,7 @@
.popover-header {
padding: $popover-header-padding-y $popover-header-padding-x;
margin-bottom: 0; // Reset the default from Reboot
font-size: $font-size-base;
@include font-size($font-size-base);
color: $popover-header-color;
background-color: $popover-header-bg;
border-bottom: $popover-border-width solid darken($popover-header-bg, 5%);
Expand Down
2 changes: 1 addition & 1 deletion scss/_progress.scss
Expand Up @@ -10,7 +10,7 @@
display: flex;
height: $progress-height;
overflow: hidden; // force rounded corners by cropping it
font-size: $progress-font-size;
@include font-size($progress-font-size);
background-color: $progress-bg;
@include border-radius($progress-border-radius);
@include box-shadow($progress-box-shadow);
Expand Down
12 changes: 6 additions & 6 deletions scss/_reboot.scss
Expand Up @@ -46,7 +46,7 @@ article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
body {
margin: 0; // 1
font-family: $font-family-base;
font-size: $font-size-base;
@include font-size($font-size-base);
font-weight: $font-weight-base;
line-height: $line-height-base;
color: $body-color;
Expand Down Expand Up @@ -155,7 +155,7 @@ strong {
}

small {
font-size: 80%; // Add the correct font size in all browsers
@include font-size(80%); // Add the correct font size in all browsers
}

//
Expand All @@ -166,7 +166,7 @@ small {
sub,
sup {
position: relative;
font-size: 75%;
@include font-size(75%);
line-height: 0;
vertical-align: baseline;
}
Expand Down Expand Up @@ -220,7 +220,7 @@ code,
kbd,
samp {
font-family: $font-family-monospace;
font-size: 1em; // Correct the odd `em` font sizing in all browsers.
@include font-size(1em); // Correct the odd `em` font sizing in all browsers.
}

pre {
Expand Down Expand Up @@ -317,7 +317,7 @@ optgroup,
textarea {
margin: 0; // Remove the margin in Firefox and Safari
font-family: inherit;
font-size: inherit;
@include font-size(inherit);
line-height: inherit;
}

Expand Down Expand Up @@ -416,7 +416,7 @@ legend {
max-width: 100%; // 1
padding: 0;
margin-bottom: .5rem;
font-size: 1.5rem;
@include font-size(1.5rem);
line-height: inherit;
color: inherit; // 2
white-space: normal; // 1
Expand Down
2 changes: 1 addition & 1 deletion scss/_toasts.scss
@@ -1,7 +1,7 @@
.toast {
max-width: $toast-max-width;
overflow: hidden; // cheap rounded corners on nested items
font-size: $toast-font-size; // knock it down to 14px
@include font-size($toast-font-size);
color: $toast-color;
background-color: $toast-background-color;
background-clip: padding-box;
Expand Down
2 changes: 1 addition & 1 deletion scss/_tooltip.scss
Expand Up @@ -7,7 +7,7 @@
// Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.
// So reset our font and text properties to avoid inheriting weird values.
@include reset-text();
font-size: $tooltip-font-size;
@include font-size($tooltip-font-size);
// Allow breaking very long words so they don't overflow the tooltip's bounds
word-wrap: break-word;
opacity: 0;
Expand Down
30 changes: 15 additions & 15 deletions scss/_type.scss
Expand Up @@ -13,36 +13,36 @@ h1, h2, h3, h4, h5, h6,
color: $headings-color;
}

h1, .h1 { font-size: $h1-font-size; }
h2, .h2 { font-size: $h2-font-size; }
h3, .h3 { font-size: $h3-font-size; }
h4, .h4 { font-size: $h4-font-size; }
h5, .h5 { font-size: $h5-font-size; }
h6, .h6 { font-size: $h6-font-size; }
h1, .h1 { @include font-size($h1-font-size); }
h2, .h2 { @include font-size($h2-font-size); }
h3, .h3 { @include font-size($h3-font-size); }
h4, .h4 { @include font-size($h4-font-size); }
h5, .h5 { @include font-size($h5-font-size); }
h6, .h6 { @include font-size($h6-font-size); }

.lead {
font-size: $lead-font-size;
@include font-size($lead-font-size);
font-weight: $lead-font-weight;
}

// Type display classes
.display-1 {
font-size: $display1-size;
@include font-size($display1-size);
font-weight: $display1-weight;
line-height: $display-line-height;
}
.display-2 {
font-size: $display2-size;
@include font-size($display2-size);
font-weight: $display2-weight;
line-height: $display-line-height;
}
.display-3 {
font-size: $display3-size;
@include font-size($display3-size);
font-weight: $display3-weight;
line-height: $display-line-height;
}
.display-4 {
font-size: $display4-size;
@include font-size($display4-size);
font-weight: $display4-weight;
line-height: $display-line-height;
}
Expand All @@ -66,7 +66,7 @@ hr {

small,
.small {
font-size: $small-font-size;
@include font-size($small-font-size);
font-weight: $font-weight-normal;
}

Expand Down Expand Up @@ -104,19 +104,19 @@ mark,

// Builds on `abbr`
.initialism {
font-size: 90%;
@include font-size(90%);
text-transform: uppercase;
}

// Blockquotes
.blockquote {
margin-bottom: $spacer;
font-size: $blockquote-font-size;
@include font-size($blockquote-font-size);
}

.blockquote-footer {
display: block;
font-size: $blockquote-small-font-size;
@include font-size($blockquote-small-font-size);
color: $blockquote-small-color;

&::before {
Expand Down

0 comments on commit 51375ab

Please sign in to comment.