css - How to get Flexbox to allow an input to be 100% width? -
i have following flexbox form powered bootstrap 4.
https://jsfiddle.net/kkt0k2bs/1/
i have media query resize form elements smaller display.
on larger displays, want form items inline, on smaller screens, want form elements stacked , @ 100%.
the input not going 100% width on smaller displays... how can enable code width 100% on smaller displays?
html:
<div class="form-mod"> <form class="form-inline justify-content-center d-inline-flex"> <div class="form-group"> <div> <input type="text" name="email" value="" placeholder="enter email..." class="form-control"> </div> </div> <div class="form-group"> <button type="submit" class="btn btn-primary">request invite</button> </div> </form> </div>
css:
.form-mod { display: inline-block; text-align: center; padding: 16px 32px; background: rgba(0, 0, 0, 0.2); border-radius: 3; box-shadow: 0 20px 63px 0 rgba(0,0,0,.6); [type="text"] { width: 260px; margin-right: 16px; border-radius: 100px; padding-left: 18px; border-radius: $border-radius; font-size: 16px; } @include media-breakpoint-down(sm) { .form-group { width: 100%; } [type="text"] { width: 100%; margin: 0 0 16px 0; display: block; } opacity: .5; } }
add code:
.form-group { flex: 1 0 auto; }
this tells flex items share space when on same line.
but when break onto separate lines, each consume available space.
Comments
Post a Comment