Check out this flexbox form I created using bootstrap 4:
https://jsfiddle.net/kkt0k2bs/1/
I have implemented a media query to adjust the form elements for smaller screens.
For larger displays, I want the form items to be displayed inline. However, on smaller screens, I prefer the form elements to stack vertically and occupy 100% width.
The issue I am facing is that the input field does not expand to 100% width on smaller screens. How can I modify the code to ensure the width is set to 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 your email..." class="form-control">
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">Request an 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;
}
}