Skip to content
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

Closed
dyve opened this issue Jun 6, 2012 · 36 comments
Closed

Add .form-condensed #3737

dyve opened this issue Jun 6, 2012 · 36 comments

Comments

@dyve
Copy link

dyve commented Jun 6, 2012

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:

.form-condensed .control-group {
    margin-top: 0;
    margin-bottom: 5px;
}
@mdo
Copy link
Member

mdo commented Jun 11, 2012

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!

@mdo mdo closed this as completed Jun 11, 2012
@dyve
Copy link
Author

dyve commented Jun 20, 2012

I agree that it's easy enough to do yourself. But:

  1. The current forms have a substantial vertical margin, enough to make forms that consist of a few lines require scrolling.
  2. There would be a logical analogy with table / table-condensed

Humble request to look at this one more time.

@yuchant
Copy link

yuchant commented Aug 9, 2012

+1 for a condensed form developed further than mere margin top and bottom.

@denispeplin
Copy link

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.

@ghost
Copy link

ghost commented Sep 20, 2012

Gonna have to agree with this one, the default forms are rather large.

@ippa
Copy link

ippa commented Nov 8, 2012

"table-condensed" makes sense. I came here googling for that exact string :)

@bastibense
Copy link

+1
By default the form-horizontal are so huge that it hurts. Might work for signup forms on websites, but as soon as you write a web app that makes use of a number of fields, this gets really annoying. Also I did type in "form-condensed" a couple of times already by intuition.

@christopheg
Copy link

+1
Default style makes the forms useless for webapps

@pjean
Copy link

pjean commented May 6, 2013

👍

@sapanparikh18
Copy link

+1 ... really need this

@severn-leon
Copy link

+1 ... forms definitely too big for some uses

@krokodile
Copy link

+1

4 similar comments
@maikoliv
Copy link

+1

@krmcbride
Copy link

+1

@benn0r
Copy link

benn0r commented Jun 20, 2013

+1

@dennis-g
Copy link

+1

@scharmetant
Copy link

+1
on several occasions, forms are just way too laaaaarge: not everyone has a 26" screen, plus theses are hard to carry in you pockets...

@heruan
Copy link

heruan commented Jul 26, 2013

I also think this should be address in 3.0.0. Now I'm adding .input-small to all inputs but this is really annoying. A .form-condensed class to do this automatically would be very useful!

@diegopso
Copy link

+1

10 similar comments
@allenlz
Copy link

allenlz commented Sep 11, 2013

+1

@MilosStanic
Copy link

+1

@geraldodev
Copy link

+1

@tarlepp
Copy link

tarlepp commented Jan 10, 2014

+1

@grishin
Copy link

grishin commented Jan 22, 2014

+1

@mukassa
Copy link

mukassa commented Jan 24, 2014

+1

@jahkeup
Copy link

jahkeup commented Jan 29, 2014

+1

@kolypto
Copy link

kolypto commented Feb 8, 2014

+1

@mrgrain
Copy link

mrgrain commented Feb 18, 2014

+1

@alahtarin
Copy link

+1

@mkeuschn
Copy link

+1

2 similar comments
@titpetric
Copy link

+1

@NAE
Copy link

NAE commented Mar 29, 2014

+1

@peterniemann
Copy link

The following worked for me

.form-group {
   margin-bottom: 1px;
}

@AllenPasch
Copy link

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;
        }
    }
}

@AllenPasch
Copy link

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;
}

@mdo
Copy link
Member

mdo commented Jun 18, 2014

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.

@twbs twbs locked and limited conversation to collaborators Jun 18, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests