-
-
Notifications
You must be signed in to change notification settings - Fork 79k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add .form-condensed #3737
Comments
Also not something we'll be adding to the core at this time. The forms can be customized easily enough to reduce this when folks need it. Thanks though! |
I agree that it's easy enough to do yourself. But:
Humble request to look at this one more time. |
+1 for a condensed form developed further than mere margin top and bottom. |
It will be great to have form-condensed class. Default forms are HUGE without any options. The solution from above does not work for twitter-bootstrap + simple_form. |
Gonna have to agree with this one, the default forms are rather large. |
"table-condensed" makes sense. I came here googling for that exact string :) |
+1 |
+1 |
👍 |
+1 ... really need this |
+1 ... forms definitely too big for some uses |
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
I also think this should be address in 3.0.0. Now I'm adding |
+1 |
10 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
2 similar comments
+1 |
+1 |
The following worked for me
|
I've written the following code: @import (reference) "../external/bootstrap/less/variables.less";
@import (reference) "../external/bootstrap/less/forms.less";
@import (reference) "../external/bootstrap/less/mixins.less";
/**
* Use .form-condensed to make a smaller Bootstrap form.
*/
@label-padding-sm: 2px;
.form-condensed {
.form-control,
.input-group-addon,
.input-group-btn > .btn {
.input-sm();
}
textarea,
select[multiple],
select[size] {
&.form-control {
height: auto;
}
}
label {
margin-bottom: @label-padding-sm;
}
.help-block {
margin-bottom: @label-padding-sm;
margin-top: @label-padding-sm;
}
.form-group {
margin-bottom: @padding-base-vertical;
}
.checkbox,
.radio {
margin-bottom: @padding-base-vertical;
margin-top: @padding-base-vertical;
}
// Reset rounded corners (taken from input-groups.less).
.input-group-addon:first-child,
.input-group-btn:first-child > .btn {
.border-right-radius(0);
}
.input-group-addon:last-child,
.input-group-btn:last-child > .btn {
.border-left-radius(0);
}
}
.form-horizontal.form-condensed,
.form-horizontal .form-condensed,
.form-condensed .form-horizontal {
.control-label {
padding-top: @padding-small-vertical;
}
.checkbox,
.radio {
margin-bottom: 0;
margin-top: 0;
min-height: @line-height-computed;
padding-top: 0;
}
}
.form-inline.form-condensed,
.form-inline .form-condensed,
.form-condensed .form-inline {
@media (min-width: @screen-sm-min) {
.form-group {
margin-bottom: 0;
}
}
}
|
While the .form-condensed class is pretty awesome, it may add complexity to the CSS in cases I haven't looked at yet, and sometimes I'm finding I want tighter control over certain parts of a form (namely the submit buttons, but sometimes help-blocks as well). So, I'm guessing Bootstrap will implement a .form-group-sm class instead of .form-condensed. Today I updated the code above and wrote the new code below. It looks nice on all of the denser forms I've Bootstrapped thus far. It'll be nice to see either a .form-condensed or .form-group-sm class in Bootstrap! @import (reference) "../external/bootstrap/less/variables.less";
@import (reference) "../external/bootstrap/less/forms.less";
@import (reference) "../external/bootstrap/less/mixins.less";
@label-padding-sm: 2px;
/**
* Use .form-group-sm to condense a .form-group.
*/
.form-group-sm {
margin-bottom: @padding-base-vertical;
label {
margin-bottom: @label-padding-sm;
}
.form-control,
.input-group-addon,
.input-group-btn > .btn {
.input-sm();
}
textarea,
select[multiple],
select[size] {
&.form-control {
height: auto;
}
}
.checkbox,
.radio {
margin-bottom: @padding-base-vertical;
margin-top: @padding-base-vertical;
}
// Reset rounded corners (taken from input-groups.less).
.input-group-addon:first-child,
.input-group-btn:first-child > .btn {
.border-right-radius(0);
}
.input-group-addon:last-child,
.input-group-btn:last-child > .btn {
.border-left-radius(0);
}
}
.form-horizontal {
.form-group-sm {
.checkbox,
.radio {
margin-bottom: 0;
margin-top: 0;
min-height: @line-height-computed;
padding-top: 0;
}
}
}
/**
* When using .input-sm, add .control-label-sm to the label.
*/
.form-horizontal {
.control-label-sm,
.form-group-sm .control-label {
padding-top: @padding-small-vertical;
}
}
/**
* Use .help-block-sm to tighten up the area around a .help-block.
*/
.help-block-sm {
margin-bottom: @label-padding-sm;
margin-top: @label-padding-sm;
}
|
This was originally for v2.x, and the latest stuff is for v3.x I think. If the need and want is still there, please open a new issue or even better a pull request. Closing this old thread out for good now though. |
The default forms are widely spaced vertically. I propose an add-on class
.form-condensed
, comparable to.table-condensed
to use less space between the lines. If I find the time to make a pull request I will, but for now, here's my local solution:The text was updated successfully, but these errors were encountered: