Difference between “maxlength” & “size” attribute in html?

后端 未结 4 1367
梦毁少年i
梦毁少年i 2021-01-31 08:48

I am little bit confused about the difference between the maxlength and the size attribute.



        
4条回答
  •  面向向阳花
    2021-01-31 09:03

    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.

提交回复
热议问题