// scss-lint:disable QualifyingElement, PropertyCount $input-line-height: 1.3; $input-border-width: 0.1rem; // Using rem instead of px so function uses same units $input-padding-vertical: 1rem; // input heights will vary by browser and type // if height not explicitly set $input-height-exact: ( ($base-font-size * $input-line-height) + ($input-padding-vertical * 2) + ($input-border-width * 2) ); // truncated to 1 decimal place // (i.e., 1.21rem -> 1.2rem) $input-height: floor($input-height-exact * 10) / 10; // Block form elements /* stylelint-disable selector-no-qualifying-type */ input, textarea, select { appearance: none; border: $input-border-width solid $color-gray; border-radius: 0; box-sizing: border-box; color: $color-base; // standardize on firefox display: block; font-size: $base-font-size; height: $input-height; line-height: $input-line-height; margin: 0.2em 0; max-width: $input-max-width; outline: none; padding: $input-padding-vertical 0.7em; width: 100%; &:focus, &.usa-input-focus { box-shadow: $focus-shadow; } &.usa-input-success { border: 3px solid $color-green-light; } } /* stylelint-enable */ .usa-input-error { border-left: 4px solid $color-secondary-dark; margin-top: 3rem; padding-bottom: 0.8rem; padding-left: 1.5rem; padding-top: 0.8rem; position: relative; right: 1.9rem; input, textarea, select { border: 3px solid $color-secondary-dark; width: calc(100% + 1.9rem); // 1.5rem left padding + 4px border from input error spacing } label { margin-top: 0; } .usa-input-inline { border: $input-border-width solid $color-gray; width: inherit; } .usa-input-inline-error { border: 3px solid $color-secondary-dark; } } .usa-input-error-label { display: block; font-size: $base-font-size; font-weight: $font-bold; } .usa-input-error-message { color: $color-secondary-dark; display: block; font-size: $base-font-size; font-weight: $font-bold; padding-bottom: 3px; padding-top: 3px; } .usa-input-required:after { color: $color-secondary-darkest; content: ' (*Required)'; } label { display: block; margin-top: 3rem; max-width: $input-max-width; } textarea { height: 16rem; } select { -moz-appearance: none; -webkit-appearance: none; appearance: none; background-color: $color-white; background-image: asset-url('#{$image-path}/arrow-down.png'); background-image: asset-url('#{$image-path}/arrow-down.svg'); background-position: right 1.3rem center; background-repeat: no-repeat; background-size: 1.3rem; } legend { font-size: $h2-font-size; font-weight: $font-bold; } .usa-fieldset-inputs { label { margin-top: 0; } } // Hint text .usa-form-hint { color: $color-gray-medium; font-family: $font-sans; margin-bottom: 0; } // Custom checkboxes [type=checkbox], [type=radio] { // The actual input element is only visible to screen readers, because // all visual styling is done via the label. @include sr-only(); .lt-ie9 & { border: 0; float: left; margin: 0.4em 0.4em 0 0; position: static; width: auto; } } [type=checkbox] + label, [type=radio] + label { cursor: pointer; font-weight: 400; margin-bottom: 0.5em; } [type=checkbox] + label::before, [type=radio] + label::before { background: $color-white; border-radius: $border-radius; box-shadow: 0 0 0 1px $color-gray-medium; content: '\a0'; display: inline-block; height: 1.8rem; line-height: 1.8rem; margin-right: 0.6em; text-indent: 0.15em; vertical-align: middle\0; // Target IE 11 and below to vertically center inputs width: 1.8rem; } [type=radio] + label::before { box-shadow: 0 0 0 2px $color-white, 0 0 0 3px $color-gray-medium; height: 1.6rem; line-height: 1.6rem; width: 1.6rem; border-radius: 100%; } [type=checkbox]:checked + label::before, [type=radio]:checked + label::before { background-color: $color-primary; box-shadow: 0 0 0 1px $color-primary; } [type=radio]:checked + label::before { box-shadow: 0 0 0 2px $color-white, 0 0 0 4px $color-primary; } [type=radio]:focus + label::before { box-shadow: 0 0 0 2px $color-white, 0 0 0 4px $color-primary, 0 0 3px 4px $color-focus, 0 0 7px 4px $color-focus; } [type=checkbox]:checked + label::before, [type=checkbox]:checked:disabled + label::before { background-image: asset-url('#{$image-path}/correct8.png'); background-image: asset-url('#{$image-path}/correct8.svg'); background-position: 50%; background-repeat: no-repeat; } [type=checkbox]:focus + label::before { box-shadow: 0 0 0 1px $color-white, 0 0 0 3px $color-primary; } [type=checkbox]:disabled + label { color: $color-gray; } [type=checkbox]:disabled + label::before, [type=radio]:disabled + label::before { background: $color-gray-lighter; box-shadow: 0 0 0 1px $color-gray-light; cursor: not-allowed; } // Range inputs [type=range] { -webkit-appearance: none; border: none; padding-left: 0; width: 100%; } [type=range]:focus { box-shadow: none; outline: none; } [type=range]::-webkit-slider-runnable-track { background: $color-gray-light; border: 1px solid $color-gray-medium; cursor: pointer; height: 1.2rem; width: 100%; } [type=range]::-moz-range-track { background: $color-primary; border: 1px solid $color-gray-medium; cursor: pointer; height: 1.2rem; width: 100%; } [type=range]::-ms-track { background: transparent; color: transparent; cursor: pointer; height: 1.2rem; width: 100%; } [type=range]::-webkit-slider-thumb { -webkit-appearance: none; border: 1px solid $color-gray-medium; height: 2.2rem; border-radius: 1.5rem; background: $color-gray-lightest; cursor: pointer; margin-top: -.65rem; width: 2.2rem; } [type=range]::-moz-range-thumb { background: $color-gray-lightest; border: 1px solid $color-gray-medium; border-radius: 1.5rem; cursor: pointer; height: 2.2rem; width: 2.2rem; } [type=range]::-ms-thumb { background: $color-gray-lightest; border: 1px solid $color-gray-medium; border-radius: 1.5rem; cursor: pointer; height: 2.2rem; width: 2.2rem; } [type=range]::-ms-fill-lower { background: $color-gray-light; border: 1px solid $color-gray-medium; border-radius: 2rem; } [type=range]::-ms-fill-upper { background: $color-gray-light; border: 1px solid $color-gray-medium; border-radius: 2rem; } [type=range]:focus::-webkit-slider-thumb { border: 2px solid $color-focus; } [type=range]:focus::-moz-range-thumb { border: 2px solid $color-focus; } [type=range]:focus::-ms-thumb { border: 2px solid $color-focus; } // Memorable dates .usa-date-of-birth { label { margin-top: 0; } [type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button { -webkit-appearance: none; appearance: none; margin: 0; } [type=number] { -moz-appearance: textfield; } } .usa-form-group-day, .usa-form-group-month, .usa-form-group-year { clear: none; float: left; margin-right: 1.5rem; width: 5rem; } .usa-form-group-year { width: 7rem; }