Input Widths in Bootstrap 3
In Bootstrap 3, managing input widths can be a challenge. While the documentation suggests using the .col-lg-x class, this solution has limitations.
Original Issue:
The original question stemmed from the inability to set input widths using .col-lg-x without affecting the container layout. This class could only be applied to the container itself, resulting in undesirable layout issues.
Solution:
A practical solution lies in wrapping each input group within its own row. By doing so, the .col-lg-x class can be applied to the individual groups, controlling their width while maintaining the overall form structure.
Code Example:
My Form
How to make these input fields small and retain the layout.
Note:
To achieve consistent sizing across different screen sizes, the .col-xs-5 class can be included for smaller screens. Removing it will not affect the overall functionality.
Conclusion:
By wrapping input groups in individual rows and using the .col-lg-x class, developers can effectively manage input widths in Bootstrap 3 without resorting to grid systems or custom CSS classes.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3