I am little bit confused about the difference between the maxlength
and the size
attribute.
max-length
is used to indicate the number of characters that can be entered in the input field regardless of how large the fields appears on the screen. The size
attribute determines how wide the field will be on the screen.
E.g., I generally use this for things like entering an email address where it can be fairly long, but for aesthetic reasons (good web design) you want the input field to be a certain length.
Once a user put in more than 20 characters for their email address, the field begins to scroll as they type.