Skip to content

Instantly share code, notes, and snippets.

@jlengstorf
Last active January 20, 2022 07:21
Show Gist options
  • Save jlengstorf/1748c72f332bcbe7d83f to your computer and use it in GitHub Desktop.
Save jlengstorf/1748c72f332bcbe7d83f to your computer and use it in GitHub Desktop.
Bootstrap styling for Gravity Forms, LESS style.

Bootstrap Styles for Gravity Forms in LESS

Include these styles in any project using Bootstrap (with LESS) and Gravity Forms to add good baseline styles for your GF Forms.

.gform_wrapper {
ul {
.list-unstyled;
margin-bottom: 10px !important;
}
li {
.form-group;
}
form {
margin-bottom: 0;
label {
margin-top: 20px;
font-weight: 400;
font-size: 18px;
}
}
.gfield_required {
padding-left: 1px;
color: @state-danger-text;
}
.form-left-half,.form-right-half {
width: 49%;
float: left;
margin-right: 2%;
@media (max-width: 377px) {
float: none;
width: 100%;
margin-right: 0;
margin-bottom: 15px;
}
}
.form-right-half {
margin-right: 0;
}
.ginput_container {
label {
font-weight: 400;
font-size: 18px;
}
input,select,textarea {
.form-control;
}
textarea {
height: auto;
&.small {
height: 5.5em;
}
}
&.ginput_complex {
.clearfix;
> span {
float: left;
display: block;
width: 49%;
margin-right: 2%;
@media (max-width: 377px) {
float: none;
width: 100%;
margin-right: 0;
margin-bottom: 15px;
}
&.ginput_right,&.ginput_full:nth-child(even) {
margin-right: 0;
margin-bottom: 0;
}
label {
display: block;
margin: 0 0 10px;
font-size: @line-height-computed*.4;
letter-spacing: .1em;
line-height: @line-height-computed*.5;
color: @gray-light;
text-transform: uppercase;
font-weight: 100;
}
}
}
.gform_card_icon_container {
display: none;
}
.ginput_card_expiration_container {
width: 66%;
display: block;
float: left;
select {
width: 48% !important;
float: left;
&:first-child {
margin-right: 4%;
}
}
}
.ginput_cardinfo_right {
float: left;
width: 30%;
margin-left: 4%;
}
.ginput_cardinfo_left {
clear: both;
overflow: hidden;
}
.ginput_card_security_code_icon {
display: none;
}
}
.gform_radio,.gfield_checkbox {
label,input {
display: inline-block;
width: auto;
height: auto;
margin: 0 2% 0 0;
outline: none;
padding: 0;
border: 0;
line-height: 1.5em;
vertical-align: baseline;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
label {
font-family: @font-family-base;
font-weight: 100;
font-size: 16px;
}
}
.gfield_radio,.gfield_checkbox {
.list-inline;
padding: 2px 0 0 0;
li {
margin-bottom: 5px;
padding-left: 10px;
padding-right: 20px;
label,input {
display: inline-block;
width: auto;
height: auto;
padding: 0 5px;
vertical-align: baseline;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
label { margin-top: 0; font-size: 15px; }
}
}
input.gform_button,.button {
.btn;
}
input.gform_button {
display: block;
margin: 0 auto;
.btn-primary;
.btn-lg;
}
.button {
.btn-default;
.btn-sm;
}
.gform_validation_container {
height: 0;
margin: 0 !important;
padding: 0 !important;
overflow: hidden;
}
.gfield_error {
.gfield_label {
color: @state-danger-text;
}
input,select,textarea {
border-color: @alert-danger-border;
background-color: @alert-danger-bg;
color: @alert-danger-text;
.form-control-focus(@alert-danger-text);
}
}
.gform_footer {
clear: left;
padding: 0 15px;
}
.validation_error {
.alert;
.alert-danger;
}
.validation_message {
font-size: @font-size-small;
.text-muted;
}
#gforms_confirmation_message {
.alert;
}
.gfield_hidden_product {
display: none;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment