The input element, unlike a div , has a default width.
Here is a simple illustration of this parameter:

The browser automatically gives the input data width.
input { border: 1px solid blue; display: inline; } div { border: 1px solid red; display: inline; }
<form> <input> <br><br> <div></div> </form>
In addition, the initial setting for flexible elements has min-width: auto . This means that elements cannot be compressed below their width on the main axis.
Therefore, input elements cannot shrink below their default widths and may be forced to overflow a flexible container.
You can override this behavior by setting min-width: 0 for your inputs ( code revised )
Here's the full explanation: why aren't flexible elements reduced to the size of the content?
In some cases, you may need to override the input width: 100% using width: 100% or width: 0 .
source share